chapter 2
play

Chapter 2 Internals and Operating System Design Overview - PowerPoint PPT Presentation

Operating Systems: Chapter 2 Internals and Operating System Design Overview Principles Eighth Edition By William Stallings Operating System Operating System A program that controls the execution of application programs An


  1. Operating Systems: Chapter 2 Internals and Operating System Design Overview Principles Eighth Edition By William Stallings

  2. Operating System Operating System � A program that controls the execution of application programs � An interface between applications and hardware

  3. Application programs Application programming interface Libraries/utilities Software Application binary interface Operating system Instruction Set Architecture Execution hardware Memory System interconnect translation Hardware (bus) I/O devices Main and memory networking Figure 2.1 Computer Hardware and Software Structure

  4. � Program development � Program execution � Access I/O devices � Controlled access to files � System access � Error detection and response � Accounting

  5. Key Interfaces Key Interfaces � Instruction set architecture (ISA) � Application binary interface (ABI) � Application programming interface (API)

  6. � A computer is a set of resources for the movement, storage, and processing of data � The OS is responsible for managing these resources

  7. � Functions in the same way as ordinary computer software � Program, or suite of programs, executed by the processor � Frequently relinquishes control and must depend on the processor to allow it to regain control

  8. Computer System I/O Devices Memory I/O Controller Printers, Operating keyboards, System digital camera, Software I/O Controller etc. Programs and Data I/O Controller Processor Processor Storage OS Programs Data Figure 2.2 The Operating System as Resource Manager

  9. Evolution of Operating Systems Evolution of Operating Systems � A major OS will evolve over time for a number of reasons:

  10. Evolution of Evolution of Operating Systems Operating Systems � Stages include:

  11. Earliest Computers: Problems: � Scheduling: � No operating system � most installations used a � programmers interacted hardcopy sign-up sheet to directly with the computer reserve computer time hardware � time allocations could � Computers ran from a console run short or long, with display lights, toggle resulting in wasted switches, some form of input computer time device, and a printer � Setup time � Users have access to the � a considerable amount of computer in “series” time was spent just on setting up the program to run

  12. Simple Batch Systems Simple Batch Systems � Early computers were very expensive � important to maximize processor utilization � Monitor � user no longer has direct access to processor � job is submitted to computer operator who batches them together and places them on an input device � program branches back to the monitor when finished

  13. Interrupt Processing � Monitor controls the sequence Device Drivers of events Monitor Job Sequencing Control Language � Resident Monitor is software Interpreter Boundary always in memory � Monitor reads in job and gives User Program control Area � Job returns control to monitor Figure 2.3 Memory Layout for a Resident Monitor

  14. � Processor executes instruction from the memory containing the monitor � Executes the instructions in the user program until it encounters an ending or error condition � “ control is passed to a job” means processor is fetching and executing instructions in a user program � “ control is returned to the monitor” means that the processor is fetching and executing instructions from the monitor program

  15. Job Control Language Job Control Language (JCL) (JCL)

  16. Modes of Operation Modes of Operation

  17. � Processor time alternates between execution of user programs and execution of the monitor � Sacrifices: � some main memory is now given over to the monitor � some processor time is consumed by the monitor � Despite overhead, the simple batch system improves utilization of the computer

  18. � Processor is often idle � even with automatic job sequencing � I/O devices are slow compared to processor

  19. Program A Run Wait Run Wait Time (a) Uniprogramming � The processor spends a certain amount of time executing, until it reaches an I/O instruction; it must then wait until that I/O instruction concludes before proceeding

  20. Program A Run Wait Run Wait Program B Wait Run Wait Run Wait Run Run Run Run Combined Wait Wait A B A B Time (b) Multiprogramming with two programs � There must be enough memory to hold the OS (resident monitor) and one user program � When one job needs to wait for I/O, the processor can switch to the other job, which is likely not waiting for I/O

  21. Program A Run Wait Run Wait Program B Wait Run Wait Run Wait Program C Wait Run Wait Run Wait Run Run Run Run Run Run Combined Wait Wait A B C A B C Time (c) Multiprogramming with three programs � Multiprogramming � also known as multitasking � memory is expanded to hold three, four, or more programs and switch among all of them

  22. JOB1 JOB2 JOB3 Type of job Heavy compute Heavy I/O Heavy I/O Duration 5 min 15 min 10 min Memory required 50 M 100 M 75 M Need disk? No No Yes Need terminal? No Yes No Need printer? No No Yes Table 2.1 Sample Program Execution Attributes

  23. Uniprogramming Multiprogramming Processor use 20% 40% Memory use 33% 67% Disk use 33% 67% Printer use 33% 67% Elapsed time 30 min 15 min Throughput 6 jobs/hr 12 jobs/hr Mean response time 18 min 10 min Table 2.2 Effects of Multiprogramming on Resource Utilization

  24. 100% 100% CPU CPU 0% 0% 100% 100% Memory Memory 0% 0% 100% 100% Disk Disk 0% 0% 100% 100% Terminal Terminal 0% 0% 100% 100% Printer Printer 0% 0% Job History Job History JOB1 JOB1 JOB2 JOB3 JOB2 0 5 10 15 20 25 30 JOB3 minutes 0 5 10 15 time minutes time (a) Uniprogramming (b) Multiprogramming Figure 2.6 Utilization Histograms

  25. � Can be used to handle multiple interactive jobs � Processor time is shared among multiple users � Multiple users simultaneously access the system through terminals, with the OS interleaving the execution of each user program in a short burst or quantum of computation

  26. Batch Multiprogramming Time Sharing Principal objective Maximize processor use Minimize response time Source of directives to Job control language Commands entered at the operating system commands provided with the terminal job Table 2.3 Batch Multiprogramming versus Time Sharing

  27. Compatible Time- - Compatible Time Sharing Systems Sharing Systems Time Slicing CTSS System clock generates interrupts � � One of the first time-sharing at a rate of approximately one operating systems every 0.2 seconds � Developed at MIT by a group At each interrupt OS regained � known as Project MAC control and could assign processor to another user � Ran on a computer with 32,000 At regular time intervals the current � 36-bit words of main memory, with user would be preempted and the resident monitor consuming another user loaded in 5000 of that Old user programs and data were � � To simplify both the monitor and written out to disk memory management a program was always loaded to start at the Old user program code and data � location of the 5000 th word were restored in main memory when that program was next given a turn

  28. 0 0 0 Monitor Monitor Monitor 5000 5000 5000 JOB 3 10000 JOB 1 JOB 2 (JOB 2) 20000 25000 25000 Free Free Free 32000 32000 32000 (a) (b) (c) 0 0 0 Monitor Monitor Monitor 5000 5000 5000 JOB 4 JOB 1 15000 JOB 2 (JOB 1) 20000 20000 (JOB 2) (JOB 2) 25000 25000 25000 Free Free Free 32000 32000 32000 (d) (e) (f) Figure 2.7 CTSS Operation

  29. � Operating Systems are among the most complex pieces of software ever developed

  30. � Fundamental to the structure of operating systems

  31. Development of the Development of the Process Process � Three major lines of computer system development created problems in timing and synchronization that contributed to the development:

  32. Causes of Errors Causes of Errors � Improper � Nondeterminate synchronization program operation � program execution is � a program must wait until interleaved by the processor the data are available in a when memory is shared buffer � the order in which programs � improper design of the are scheduled may affect signaling mechanism can their outcome result in loss or duplication � Deadlocks � Failed mutual exclusion � it is possible for two or more programs to be hung � more than one user or up waiting for each other program attempts to make use of a shared resource at � may depend on the chance the same time timing of resource � only one routine at a time allocation and release allowed to perform an update against the file

  33. � The execution context � A process contains is essential: three components: � it is the internal data by which � an executable program the OS is able to supervise and control the process � the associated data � includes the contents of the needed by the program various process registers (variables, work space, � includes information such as buffers, etc.) the priority of the process and whether the process is � the execution context waiting for the completion of (or “process state”) of a particular I/O event the program

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend