Full Transcript

Resources and their Management „ Inthe previous Chapter you had seen an overview of the computer’s hardware and its various components. „ From an abstract perspective, all those components can be viewed as “resources”. „ The main task of the operating system is...

Resources and their Management „ Inthe previous Chapter you had seen an overview of the computer’s hardware and its various components. „ From an abstract perspective, all those components can be viewed as “resources”. „ The main task of the operating system is the frugal and efficient allocation and management of the available resources for (and to) the “users” (humans or programs) of the computer. Textbook Section 2.1 „ OS:A program that controls the execution of application programs „ An interface between applications and hardware The Operating System as “Shield” See Figure 2.1 in the book for further details and explanations The user is shielded from the confusing technical details of the hardware. Instead of User seeing the hardware, the user sees the OS. The operating system provides well-defined functions for accessing the hardware in a Operating System well-defined manner. Hard The hardware’s resources are thus shielded ware from inappropriate access or un-desired utilisation by incompetent or malicious users. „ Program development (editors and debuggers) „ Program execution „ Access to I/O devices „ Controlled access to Files „ Concurrent System Access (by multiple users) „ Error detection and response „ Accounting (resource utilization statistics) Study section 2.1 in the book for further details and explanations „ Because the Operating System itself is software, too, it competes with (or against) the user’s application software for the same hardware resources (CPU etc.), and must thus also manage itself! „ The OS must thus frequently “relinquish control” (to the user’s software) and must rely on special hardware mechanisms to regain control again. (While the user’s program utilizes the CPU, the OS cannot “do” anything, because “doing something” implies CPU utilization) Evolution of Operating Systems: Textbook Section 2.2 ƒ A major OS will evolve over time for a number of reasons: } External Reasons } Internal Reasons Main “path” of Evolution of Operating Systems ƒ Stages include: Human Operator no OS Serial Processing /Simple Batch Systems „ Early Operating Systems mainly “mimicked” the work-behavior of the human operator. „ The underlying principle was that a user-program U had to run entirely to completion before a subsequent user program U’ was allowed to start. „ The “Monitor” component had to recognize the completion of a user program, and then to carry out the necessary administrative tasks (code-loading, etc.) to prepare the run of the subsequent user-program, and so on, until the whole “batch” of user-programs was carried out. Interrupt „ Monitor controls the sequence of Processing Device events Monitor Drivers Job Sequencing „ Resident Monitor is software Control Language always in memory Boundary Interpreter „ Monitor reads in job and gives control User Program Area „ Job returns control to monitor Figure 2.3 Memory Layout for a Resident Monitor „ The CPU does NOT know whether it processes User Software or Operating System’s software (Monitor)! „ CPU executes instruction from the memory containing the monitor Î OS is running „ CPU executes the instructions in the user program (until it encounters an ending or error condition) Î user software is running „ “Control is passed to a job” means: CPU is fetching and executing instructions in a user program „ “Control is returned to the monitor” means: CPU is fetching and executing instructions from the monitor program Remember Section 5.6, “Program Execution”, in the COS151 Textbook See Textbook, Section 2.2, for the discussion of several further details. For “Instruction Set”, please also recall Table 5.4 in the book of COS151. „ Processor time alternates between execution of user programs (P1, P2, P3, … Pn) and execution of the monitor (M): M | P1 | M | P2 | M | P3 | M | … … | M | Pn | M | TIME „ Sacrifices (Management Costs): „ Some main memory is now given over to the monitor „ Some CPU time is consumed by the monitor „ Despite overhead, the simple batch system improves utilization of the computer in comparison against the slow “manual” processing of jobs by a human operator. „ However, CPU utilization (efficiency) becomes very poor when the a user-program makes frequent I/O operations, because I/O operations are very slow: Figure 2.4 System Utilization Example Figure 2.5 a) 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 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 space to hold the OS (resident monitor) and more than one user program (A, B, C…) „ 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 „ Whereas “early” user application programs did mostly mathematical calculations to emitted a final result, “modern” user applications frequently communicate or “interact” with their environment: See, for example, a computer game which users play. „ Time-Sharing Systems are Operating Systems which combine the idea of Multi-Programming (see above) with additional features that are needed to support especially “interactive” programs. „ They can be used to handle multiple interactive jobs, whereby CPU time is shared among multiple users „ Multiple users simultaneously access the system through terminals, whereby the OS “interleaves” the execution of all user programs in frequent short “bursts” of computation-time. Batch Multiprogramming Time Sharing Table 2.3 Batch Multiprogramming versus Time Sharing Compatible Time-Sharing System (CTSS) „ History: CTSS was one of the first time-sharing operating systems (developed for the IBM709 in 1961) „ Utilized a technique known as time slicing „ System clock generated interrupts at a rate of approximately one every 0.2 seconds „ At each clock interrupt the OS regained control and could assign another user CPU „ Thus, at regular time intervals the current user would be pre-empted and another user loaded in „ To preserve the old user program status for later resumption, the old user programs and data were written out to disk before the new user programs and data were read in „ Old user program code and data were restored in main memory when that program was next given a turn The details of these management activities will be discussed later in Chapters 3 (Processes), 7 (Memory Management), and 9 (Scheduling) Example: Memory Status at different Time-Points during the Run of CTSS Monitor Monitor Monitor JOB 3 JOB 1 JOB 2 (JOB 2) Free Free Free Monitor Monitor Monitor JOB 4 JOB 1 JOB 2 (JOB 1) (JOB 2) (JOB 2) Free Free Free The red areas show the memory sections utilized by the various user-jobs. In this example, the user-jobs are serviced in the following sequence: Figure 2.7 J1, J2, J3, J1 (continuation), J4, J2 (continuation) TheFigure 2.7 CTSSoverwrites Operating-System Operationthe memory-section with the data of the active job, because memory was a scarce resource in the early 1960. „ Operating Systems are among the most complex pieces of software ever developed „ Majoradvances in the history of OS development entail: „ Multiple User-Processes „ Memory Management „ Information Protection and Security „ Job Scheduling and resource management „ System Architecture (Software Engineering) (End of Part A)

Use Quizgecko on...
Browser
Browser