Chapter10 - Chapter 10: Operating Systems An operating...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 10: Operating Systems An operating system is a set of programs through which a computer manages its resources. Its main functions are to: 1) Manage the computer hardware CPU performance & utilization Memory allocation & protection Input-output management Keyboard control Mouse device driver Printer spooling Display monitor Chapter 10 Operating Systems Page 1 2) Support application software Word processors Electronic spreadsheets Database management Computer graphics & games Chapter 10 Operating Systems Page 2 3) Establish a user interface Textual, with a command-line prompt Graphical, with windows, menus, and icons Chapter 10 Operating Systems Page 3 Different Approaches to Processing Batch Processing Non-interactive execution of one or more programs with distinct input and output sessions Time-Sharing Multiple programs executing "simultaneously" (via time slices) on a single computer (either many users on a server or one user "multitasking") RAM Process PCB Process PCB Process PCB CPU Interactive Processing Execution of a program with additional input from the user and output to the user during execution Multiprocessing Multiple CPUs available within the computer system, either across a network or within a single machine (e.g., a supercomputer) Chapter 10 Operating Systems Page 4 Memory Management The operating system must coordinate the use of main memory for any active program on the computer. When the When the program is compiled, fake "virtual" addresses are used as placeholders for the memory addresses of data (i.e., variables) and instructions (i.e., functions, loops, and conditionals). program is loaded into RAM, the virtual "logical" addresses are mapped to actual "physical" addresses where the various parts of the program are really stored. Chapter 10 Operating Systems Page 5 Paging Since multiple programs might be active simultaneously and since RAM has a limited capacity, large segments of one program's memory might be relegated to a backup device to make room for another program's memory needs. Program A's Virtual Space RAM Backup Storage (Disk) 1 2 3 4 4 1 5 1 1 2 3 7 2 4 2 3 3 2 2 1 1 3 4 8 4 7 1 3 5 6 3 1 6 4 1 2 4 1 3 2 3 2 5 Program B's Virtual Space 6 1 4 3 1 2 3 In this example, when program B is activated, space in RAM is made available by first "paging out" part of program A... ...and then "paging in" program B. Chapter 10 Operating Systems Page 6 CPU Management Every process executed by the CPU is managed by the operating system. New Process (In a file on the hard drive, it needs to be loaded into RAM) OS "admits" process by loading into RAM Conceptually, the operating system moves the process from state to state in its journey through CPU execution. OS "dispatches" Ready Running process by Process Process allotting CPU time (Loaded (In RAM, into RAM, it with CPU will run processing OS "interrupts" when its process to give allotted instruction another process CPU time) s) CPU time Waiting OS moves OS moves Process process to ready process to waiting (Needs I/O state when it's state when it or some ready to resume starts idling event in memory, temporarily can't run) Terminated Process (Finished executing, its memory must be marked "free") OS starts cleaning up after the process has completed CPU Scheduling When multiple processes are vying for the CPU's attention, the operating system must schedule them. Common Scheduling Options: First-Come First-Served (FCFS) Disadvantage: Smaller jobs may have to wait an inordinate amount of time. Shortest Job First (SJF) Disadvantage: Large jobs must wait until everything else is finished before starting. Round Robin Disadvantage: Processes constantly interrupted when time slices expire. Multilevel Feedback Queue How do operating systems like Windows and Unix handle CPU scheduling? 1. Set up several queues, with processes assigned by their priority 2. The CPU is allotted a certain amount of time per queue, with longer amounts for higher priorities. 3. Each process in each queue is given a specific amount of time to finish. 4. If a process doesn't finish on time, it's interrupted and placed at the end of the next lower priority queue. 5. If a process has to perform an I/O access, it's placed at the end of its current queue, so it can resume at the same priority when it reaches the front of the queue again. Resource Allocation Poblems Mutual Exclusion If two processes require access to the same nonshareable resource at the same time, then both cannot be accommodated. Example: Producer & Consumer Waiting Producer Full Queue Consumer When extreme cases occur (either there are no resources available to be consumed, or no room for more to be produced), a "semaphore" is set to signal that someone must wait. Producer Waiting Empty Queue Consumer Deadlock If two processes are simultaneously blocking each other's progress, then neither one may be able to proceed. One process copies from the flash to the DVD One process copies from the DVD to the flash Chapter 10 Operating Systems Page 10 ...
View Full Document

This note was uploaded on 08/26/2009 for the course CS 111 taught by Professor Klein,s during the Fall '08 term at Southern Illinois University Edwardsville.

Ask a homework question - tutors are online