Sie sind auf Seite 1von 5

Multi-tasking allows several programs to be active at the same time, although at an instant in time the CPU is doing only

one instruction for one of the active programs. The operating system manages which instructions to send to the CPU ince computers are so fast, the operating system can switch the program that gets to e!ecute on the CPU so "uickly.

# Categories of operating system$s tasks Processor management - involves putting the tasks into order and paring them to manageable si%e before they go to the CPU. Memory Management - coordinates data to and from &'M and determines the necessity for virtual memory. (evice management - provides intface between connected devices. torage management - directs permanent data storage. 'pplication interface - allows standard communication between software and computer. User interface - alllows to communicate with computer. (iscussion) Processor management The heart of managing the processor comes down to two related issues *. +nsures that each process and application receives enough of the processor$s time to function properly ,. Use as many processor cycles for real work as is possible -n a simple system, one with a single user and one processor, the process is busy only when it is e!ecuting the user$s .obs. /owever, when there are many users, such in a multiprogramming environment, or when there are multiple processes competing to be run by a single CPU, the processor must be allocated to each .ob in a fair and effecient manner.

(efinition of terms) Program - an inactive unit, such as a file stored on a disk. ' program is not a process. -n 0 , a program or .obs is a unit of work that has been submitted by the user. Process - is an active entitty that re"uires a set of resources, including a processor and special registers, to perform its function. ' process, also called task, a single instance of a program in e!ecution. Thread - portion of a process that can run independently. 1or e!ample, if your system allows to have a single thread of control and you want To see a series of pictus on a friend$s website, you can instruct the browser to establish one connection between the two sites and downloads one picture at a time. Processor - also known as the CPU, the part of the machine that performs the calculations and e!ecutes the programs. Multiprogramming - re"uires that the processor be allocated to each .ob or to each process for a period of time and deallocated at an appropriate moment. ample scenario) /ere you are, confident you can put together a toy despite the warning that some assembly is re"uired. 'rmed with the instructions and lots of patience, you embark on your task- to read the directions, collect the necessary tools, follow each step in turn, and turn out to finished product. The first step is to .oin Part ' to Part 2 with a screw, and as you complete that task you check off

tep *. -nspired by your success, you move on to tep , and then tep 3. 4ou$ve only .ust completed the third step when a neighbor is in.ured while working with a power tool and cries for help. 5uickly you check off tep 3 in the directions so you know where you left off, then you drop your tools and race to your neighbor$s side. 'fter all, someone$s immediate need is more important than your eventual succes with the toy. 6ow you find yourself engaged in a very different task) following the instructions in a first-aid book and using bandages and antiseptic. 0nce the in.ury has been successfully treated, you return to your previous .ob. 's you pick up your tools, you refer to the instructions and see that you should begin with tep 7. 4ou then continue with this pro.ect until it is finally completed. -n operating system terminology, you played the part of the CPU or processor. There were two programs, or .obs- one was the mission to assemble the toy and the second was to bandage the in.ury. 8hen you were assembling the toy 9:ob ';, each step you performed was a process. The call for help was an interrupt< and when you left the toy to treat your wounded friend, you left for a higher priority program. 8hen you were interrupted, you performed a conte!t switch when you marked tep 3 as the last completed instruction and put doen your tools. 'ttending to the neighbor$s in.ury became:ob 2. 8hile you were e!ecuting the first-aid instructions, each of the steps you e!ecuted was again a process. 'nd, of course, when each .ob was completed it was finished or terminated. 'n interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. The control program that handles the interruption se"uence of events is called the interrupt handler.

Processor Manager The processor manager is a composite of two submanagers) one in charge of .ob scheduling and the oth in charge of process scheduling. They$re known as ghe :ob scheduler and the Process scheduler. :ob cheduling =ersus Process cheduling The scheduling of two .obs, to assemble the toy and to bandage the in.ury, was on a first-come, firstserved and priority basis. +ach .ob is initiated by the :ob cheduler based on certain criteria. 0nce a .ob is selected for e!ecution, the Process cheduler b (etermines when each steps, or set of steps, is e!ecuted- a decision that$s also based on certain criteria. 8hen you started assembling tne toy, each step in the assembly instructions would have been selected for e!ecution by the Process cheduler. Therfore, each .ob or program passes through a hierarchy of managers. ince the first one it encounts is the :ob chedul, this is also called the high-level scheduler. -t is only concerned with selecting .obs from a "ueue of incoming .obs and placing them in the process "ueue, whether batch or intactive, based on each .ob$s characteristics. The :ob cheduler$s goal is to put the .obs in a se"uence that will use all of the system$s resources as fully as possible. The Process cheduler is the low-level scheduler that assigns the CPU to e!ecute the processes of those .obs placec on thr &+'(4 "ueue by the :ob cheduler. :ob and Process tatus 's a .ob moves through the system, it is always in one of five states) 1rom /0>( to &+'(4 to &U66-6? to

8'-T-6? to 1-6- /+( Process Control 2locks 9PC2; +ach process in the system is represented by a data structure called Process Control 2lock that performs the me functions as a traveler$s passport. The pcb contains the basic information about the .ob, including what it is, where it$s going, how much of its processing has been completed, where it$s stored, and how much it has spent in using resources. ' .ob$s PC2 is created when the :ob scheduler accepts the .ob and is updated as the .ob progresesses from the beginning to the end of its e!ecution. 5ueues use PC2 to track .obs the same wat custom officials use passports to track intnational visitors. The PC2 contains all of the ta about the .ob needed by the operating system to manage the processing of the .ob. 's the .ob move through the system, its progress is noted in the PC2. Process cheduling The Process cheduler relies on a process scheduling algorithm, based on a specific policy, to allocate the CPU and move the .obs through the system. o Process cheduling 'lgorithm *. 1irst-Come, 1irst- erved - nonpreemptive scheduling algorithm that handles .obs according to their arrival time) the earlier they arrive, the sooner they$re served. -t is a very simple algorithm to implement because it uses a 1-10 "ueue. ,. hortest :ob 6e!t 9 :6; - nonpreemptive scheduling algorithm also knwn as hortest :ob 1irst that handles .obs based on the length of their CPU cycle time. 3. hortest &emaining Time 9 &T; - the preemptive version of :6 algorithm. The processor is allocated to the .ob closest to completion. 7. Priority cheduling - non preemptive algorithm and one of the most common scheduling algorithms in batch systems, even though it may give slower turnaround to some users. @. &ound &obin - preemptive scheduling allgorithm that used e!tensively in interactive systems. -ts$s easy to implement and isn$t based on .ob characteristics but on a predetermined slice of time that$s given to each .ob to ensure that CPU is e"ually shared among all active and isn$t monopoli%ed by any one .ob. The time slice is called a time "uantum and its si%e is crucial to the performance of the system. (eadlock (eadlock was known by the more descriptive phrase Adeadly embraceA and that$s e!actly what happens when the system free%es. -t is a system-wide tangle of resource re"uests that begins when two or more .obs are put on hold, each waiting for a vital resource to become available. ample scenario) ' narrow staircase in a building. The staircase was built as a fire escape route, but people working in the building often take the stairs instead of waiting for the slow elevators. Traffic on the staircase moves well unless two people, traveling in opposite directions, need to pass on the stairs- there$s room for only one person on each step. -n this e!ample, the staircase is the system and the steps and landings are the resources. There$s a landing between each floor and its wide enough for people to share it, but the stairs are not and n be allocated to only one person at a time. Problems occur when someone going up the stairs meet someone coming down, and each refuses to retreat to a wider place. imilarly, if two people on the landing try to pass each other but cannot do so because as one steps to the right, the other steps to the left, and vice versa, then the step-climbers will continue moving but neither

will ever move forward. This is called livelock. Memory Management The management of main memory is critical. Memory Manager is also known as random access memory, core memory, or primary storage. Memory Management cheme ingle-User Contiguos cheme - the first memory allocation scheme worked like this) each program to be processed was loaded in its entirely into memory and alloted as much contiguous space in memory as it needed. The keywords are entirely and contiguous. -f the program was too large and didn$t fit the available memory space, it couldn$t be e!ecuted. 1i!ed Partitions - also called static partitions., one partition for each .ob. 0nce partition was assigned to a .ob, no other .ob could be allowed to enter its boundaries. Partial usage of fi!ed partitions and the coinciding creation of unused spaces within the partition is called internal fragmentation. (ynamic Partitions - with dynamic partitions, available memory is still kept in contiguous blocks but .obs are given only as much memory as they re"uest when they are loaded for processing. 2efore a .ob is loaded into memory, it is divided into parts called pages that will be loaded into memory locations called page frames. Paged memory allocation is based on the concept of dividing each incoming .ob into pages of e"ual si%e. The sections of a disk are called sectors and the sections of main memory are called page frames. (emand paging introduced the concept of loading only a part of the program into memory for processing. 0ne of the most important innovations of mand paging was that it made virtua memory feasible. The demand of paging scheme allows the user to run .obs with less main memory. The capability of moving pages at will between main memory and secondary storage gave way to a new concept appropriately named virtual memory. Cache memory is a small, fast memory used to hold selected data and to provide faster access than would otherwise be possible. Caching is based on the idea that the system can use a small amount of e!pensive high speed memory work faster than main memory.

(evice Management (evice management involves four basic functions) *. Monitoring the status of each device, such as storage drives, printers and other peripheral devices ,. +nforcing preset policies to determine which process will get a device and for how long 3. 'llocating the devices 7. (eallocating Types of (evices (edicated devices - assigned to only one .ob at a time hared devices - can be assigned to several processes =irtual devices - a combination of the first two) dedicated device thatbhave been transformed into shared devices. +!) Printer User -nterface :ust as drivers provide a way for applition to make use of hardware subsystems without having to know every detail of the hardware$s operation, applicatioon program interfaces

9'P-s; let application programmers use functions of the computer and operating system without having to directly keep track of all the details in the CPU$s operation.