150 likes | 315 Views
Chapter 5 System Softwares. Hardware. Introduction. User interface: Virtual machine:. System softwares. System softwares: A collection of computer programs that manage the resources of a computer and facilitate access to those resources. User. Virtual machine interface. Virtual machine.
E N D
Hardware Introduction • User interface: • Virtual machine:
System softwares • System softwares: • A collection of computer programs that manage the resources of a computer and facilitate access to those resources User Virtual machine interface Virtual machine System softwares Actual machine interface Hardware
System softwares • Role of System softwares: • Hide from user details of the internal structure of machine • Present important information in a way that is easy to understand • Allow the user to access computing resources in a simple and efficient way • Provide a secure and safe environment in which to operate • Types of system softwares: Operating systems Language translator Memory managers Info. managers Scheduler utility database systems text editor file systems assembler compilers loaders linkers ...
Types of system software • Language translator: • assembler • compiler • Memory managers: • allocate memory space for programs and date and load programs into memory prior to execution • File system: • handle the storage and retrieval of information on mass storage devices such as disks, CD-ROMs, and tapes • Scheduler: • Keeps a list of programs ready to run on the processor and selects the one that will execute next • Utilities: • library routines that provide useful services to either a user or other system routines • text editor • debugging tools
Assembler and assembly language • Machine language: • use binary • allow only numeric memory addresses • difficult to change • difficult to create data • Assembly language: assembly language program machine language program assembler Loader loaded into memory results Hardware
Assembly language • Advantages of using assembly language: • Use of symbolic operation codes rather than numeric ones • Use of symbolic names rather than numeric memory addresses • Pseudo-operations that provide useful user-oriented services such as data generation • Sample assembly language: • format: • Example: jump loop . . . loop: load X • Data generation: five: data 5 negseven: data -7 lable: op-code mnemonic address field
Assembly language • Sample assembly language instruction set: op-code mnemonic meaning 0000 load X con(X) -> R 0001 store X R -> con(X) 0010 clear X 0 -> con(X) 0011 add X R + con(X) -> R 0100 increment X con(X) + 1 -> con(X) 0101 subtract X R - con(X) -> R 0110 decrement X con(X) - 1 -> con(X) 0111 compare X if con(X) > R then GT= ON if con(X) = R then EQ = ON if con(X) < R then LT = ON 1000 jump X transfer to location X 1001 jumpgt X transfer to location X if GT = ON 1010 jumpeq X transfer to location X if EQ = ON 1011 jumplt X transfer to location X if LT = ON 1100 jumpneq X transfer to location X if EQ=OFF 1101 in X input an integer from standard input device and store in location X 1110 out X output the value in location X 1111 halt stop program execution
Example load B add C subtract SEVEN store A . . . A: data 0 B: data 0 C: data 0 SEVEN: data 7 • Exercise: • write an assmbly program to compute the sum of 1+3+5+...+99
Assembler • Assembler's jobs: • convert symbolic op codes to binary • convert symbolic addresses to binary • put the translated instructions into a file for future use • Two-pass assembler: • first pass: • symbol table • second pass: • translate source program into machine language
Operating system user user Input- Output storage Operating system Hardware
Operating system • Functions of OS: • user interface • program scheduling and activation • system and file access control • efficient resource allocation • deadlock detectionand error detection • deadlock: • Example: • Program A Program B • get tape driver get laser printer • get laser printer get tape driver • print the file print the file • deadlock prevention • if a program cannot get all resources it needs, it must give up all resources it currently owns and issue a completely new request • deadlock recovery
Events in execution User User User command center Scheduler Resource allocator Dispatcher Hardware Execution
Time sharing • Multiuser systems User User Machine User User time cycle A C B A C B
Scheduling • CPU burst time: • Actual CPU time for a job in its time period • Scheduling algorithms • First-In-FIrst-Out (FIFO): FCFS • Shortest Job First (SJF) • Round Robin (RR) • Classes of scheduling algorithms: • Nonpreemptive • do nor allow a job to be stopped once its CPU burst starts • Preemptive