Unformatted text preview:

ProcessesThe Process ModelMultiprogramming of Four Programs.Multiprogramming of Four Programs. (II)Multiprogramming of Four Programs. (III)ProblemProcess HierarchiesProcess StatesTransition State DiagramAlternative ViewSchedulerImplementation of ProcessesSample FieldsThreadsHeavyweight ThreadsLightweight ThreadsThreads IIThreads IIIDesign IssuesDesign Issues (II)Design Issues (III)Good News, Bad NewsInterProcess CommunicationsThree IssuesRace ConditionsRace Conditions (II)Race Conditions ExampleRace Conditions Example (II)Critical SectionsMutual ExclusionSolutionFour ConditionsMutual Exclusion with Busy WaitingLock VariablesLock Variables FaultsStrict AlternationStrict Alternation FaultsPeterson's SolutionPeterson's Solution (II)Peterson's Solution (III)TSL InstructionTSLPeterson's Solution & TSL Instruction FaultPriority Inversion ProblemSLEEP & WAKEUPProducer-Consumer ProblemBuffer ProblemsFatal Race ConditionFatal Race Condition (II)Fatal Race Condition (III)SemaphoresSemaphores (II)Producer-Consumer Problem RevisitedProducer-Consumer Problem Revisited (II)Producer-Consumer Problem Revisited (III)MonitorsMonitors (II)Monitors (III)Monitors (IV)Down SideMessage PassingMessage Passing (II)Message Passing (III)ExamplesClassical IPC ProblemsThe Dining Philosophers ProblemThe Dining Philosophers Problem (II)Readers and Writers ProblemSleeping Barber ProblemSleeping Barber Problem (II)Sleeping Barber Problem CodeSleeping Barber Problem Code (II)Sleeping Barber Problem Code (III)Process SchedulingScheduling CriteriaScheduling Criteria (II)ClocksPreemptive SchedulingRound RobinRound Robin (II)Round Robin (III)Priority SchedulingPriority Scheduling (II)Priority Scheduling (III)Multiple QueuesShortest Job FirstGuaranteed SchedulingLottery SchedulingTwo-level SchedulingTwo-level Scheduling (II)Policy versus MechanismReal-Time SchedulingReal-Time Scheduling(II)Real-Time Scheduler AlgorithmsInternal Structure of MINIXInternal Structure of MINIX (II)Internal Structure of MINIX (III)Process ManagementProcess Management (II)Process Management (III)I/O Tasks LayerKernelKernel (II)System TaskServer ProcessesServer Processes (II)User ProcessesProcess Management in MINIXBoot ProcessBoot Process (II)Boot Process (III)Boot Process (IV)Creating ProcessesIPCs in MINIXSlide 115Process Scheduling (II)Process Scheduling (III)Process Scheduling (IV)Process Scheduling (V)Process Scheduling (VI)ResourceOrganization of source codeOthersConventionsMemory LayoutMemory Layout (II)Some Code ItemsSlide 128Interrupt Processing HardwareInterrupt HandlingInterrupt Handling (II)Interprocess CommunicationsQueuesHardware-Dependent CodeUtilities and the Kernel LibrarySummarySummary (II)Summary (III)Summary (IV)Summary (V)Summary (VI)Gary Burt 01/14/19 1ProcessesCMSC-421Operating Systems PrinciplesChapter 2Gary Burt 01/14/19 2The Process ModelAll the runnable software on the computer, including the operating system is organized into a number of sequential processes.A process is just an executing program, including the current values of the program counter, registers, and variables.Gary Burt 01/14/19 3Multiprogramming of Four Programs.ABCDOne programcounterProcessSwitchGary Burt 01/14/19 4Multiprogramming of Four Programs. (II)Four program countersA B C DGary Burt 01/14/19 5Multiprogramming of Four Programs. (III)Time ABCDGary Burt 01/14/19 6ProblemWith the CPU switching back and forth among an unknown number of processes, the rate at which a process performs its computation will not be uniform, and probably not even reproducible.This causes a problem for real-time processes!Gary Burt 01/14/19 7Process HierarchiesOperating systems that support the process concept must provide some way to create all the processes needed.Init starts all of the necessary processes when the computer is booted.All subsequent processes can created new processes.Gary Burt 01/14/19 8Process StatesPossible states:»Running–Actually using the CPU at that instant.»Ready–Runnable; temporarily stopped to let another process run.»Blocked–Unable to run until some external event happens.Gary Burt 01/14/19 9Transition State DiagramRunningBlockedReady12341. Process blocksfor input2. Scheduler picksanother process3. Scheduler picks this process4. Input becomes availableGary Burt 01/14/19 10Alternative View01...nn - 1schedulerGary Burt 01/14/19 11SchedulerAccording to this view, the scheduler not does process scheduling, but also interrupt handling and all the interprocess communication.Gary Burt 01/14/19 12Implementation of ProcessesOS maintains a process table with one entry per process.Contains process state, pc, stack pointer, memory allocation, status of open files, accounting and scheduling information.Gary Burt 01/14/19 13Sample FieldsProcess mgmt Memory mgmt file mgmtRegisters Pointer to text seg. UMASKPC Pointer to data seg. Root directoryPSW Pointer to bss seg. Working directoryStack pointer Exit status File descriptorsProcess state Signal status Effective UIDTime started PID Effective GIDChildren CPU time PPID System call ParamTime next alarm Real UID Various flag bitsMessage queue Effective UIDPending signal bits Real GIDPID Bit maps for signalsVarious flag bits Various flag bitsGary Burt 01/14/19 14ThreadsIn a traditional process, there is a single thread of control and a single pc in each process.In some modern OS, support is provided for multiple threads of control within a process.Gary Burt 01/14/19 15Heavyweight ThreadsProgramCounterThread ProcessComputerGary Burt 01/14/19 16Lightweight ThreadsComputerGary Burt 01/14/19 17Threads IIAn example of when to use threads, is for a server. The server is one single process, but each connection is a separate thread. This allows critical data to be shared in the process global memory and available without special handling. When one connection is not sending data, only that thread is blocked.Gary Burt 01/14/19 18Threads IIIAnother example of using threads is in Netscape. One process can have a section of code to manage the internet connections, since there is one logical connection for each image on the screen.There is one standard thread package, POSIX P-threads.Gary Burt 01/14/19 19Design IssuesThe two alternatives seem equivalent.Difference is in performance. Switching threads is much faster when thread management is done in user space than when a kernel called needed.When one thread blocks for I/O, all threads are


View Full Document

UMBC CMSC 421 - Processes

Documents in this Course
Load more
Download Processes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Processes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Processes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?