Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 5 System Softwares Computer Science/Ch. 5 System Softwares 5-1 Introduction • User interface: Hardware • Virtual machine: Computer Science/Ch. 5 System Softwares 5-2 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 Computer Science/Ch. 5 System Softwares 5-3 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 Memory managers ... text editor 5-4 database systems file systems linkers loaders compilers assembler Computer Science/Ch. 5 System Softwares Info. Scheduler managers utility Language translator 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 Computer Science/Ch. 5 System Softwares 5-5 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 assembler machine language program Loader loaded into memory results Computer Science/Ch. 5 System Softwares 5-6 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: lable: op-code mnemonic address field • Example: loop: jump loop . . . load X • Data generation: five: data 5 negseven: data -7 Computer Science/Ch. 5 System Softwares 5-7 Assembly language • Sample assembly language instruction set: op-code mnemonic meaning 0000 0001 0010 0011 0100 0101 0110 0111 load X store X clear X add X increment X subtract X decrement X compare X 1000 1001 1010 1011 1100 1101 jump X jumpgt X jumpeq X jumplt X jumpneq X in X 1110 1111 out X halt con(X) -> R R -> con(X) 0 -> con(X) R + con(X) -> R con(X) + 1 -> con(X) R - con(X) -> R con(X) - 1 -> con(X) if con(X) > R then GT= ON if con(X) = R then EQ = ON if con(X) < R then LT = ON transfer to location X transfer to location X if GT = ON transfer to location X if EQ = ON transfer to location X if LT = ON transfer to location X if EQ=OFF input an integer from standard input device and store in location X output the value in location X stop program execution Computer Science/Ch. 5 System Softwares 5-8 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 Computer Science/Ch. 5 System Softwares 5-9 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 Computer Science/Ch. 5 System Softwares 5-10 Operating system user user InputOutput storage Operating system Hardware Computer Science/Ch. 5 System Softwares 5-11 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 » get tape driver » get laser printer » print the file Program B get laser printer get tape driver 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 Computer Science/Ch. 5 System Softwares 5-12 Events in execution User User command center Scheduler Resource allocator Dispatcher Hardware Execution Computer Science/Ch. 5 System Softwares 5-13 User Time sharing • Multiuser systems User User Machine User User time cycle A B C Computer Science/Ch. 5 System Softwares A 5-14 B C 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 Computer Science/Ch. 5 System Softwares 5-15