Processes and PipesWhen to Change Which Process is Running?Life Cycle of a ProcessSwitching Between ProcessesForkForkWaitExecFork/ExecSystemNetworksInterprocess CommunicationPipesCreating a PipePipe ExampleDupDup2Pipes and StdioPipes and ExecA Unix Shell!1Processes and PipesCOS 217Prof. David August2When to Change Which Process is Running?• When a process is stalled waiting for I/Oo Better utilize the CPU, e.g., while waiting for disk access• When a process has been running for a whileo Sharing on a fine time scale to give each process the illusion of running on its own machineo Trade-off efficiency for a finer granularity of fairnessCPUCPUCPUI/OI/O I/O1:CPUCPUCPUI/OI/O I/O2:3Life Cycle of a Process• Running: instructions are being executed•Waiting:waiting for some event (e.g., I/O finish) • Ready: ready to be assigned to a processorCreate Ready Running TerminationWaiting4Switching Between ProcessesRunningRunningSave contextLoad contextSave contextLoad context......Process 1Process 2RunningWaitingWaitingWaiting5Fork6Fork7Wait8Exec9Fork/Exec10System11Networks12Interprocess Communication13Pipes14Creating a Pipe15Pipe Example16Dup17Dup218Pipes and Stdio19Pipes and Exec20A Unix
View Full Document