Chapter 3: Processes modified by your instructorChapter 3: ProcessesIntroductory Remarks – Quick Review Concepts SlideProcess ConceptProcess in MemoryProcess StateDiagram of Process StateProcess Control Block (PCB)Slide 9CPU Switch From Process to ProcessProcess Scheduling QueuesSlide 12Observe the Structure of the PCB in LinuxReady Queue And Various I/O Device QueuesRepresentation of Process SchedulingSchedulersSchedulerSchedulers (Cont.)More on SchedulersContext SwitchShells and the KernelKernelKernel SubsystemsKernel Subsystems – a view of files and I/O…Slide 25Talking to the KernelVisual on Talking to the KernelShellsSlide 29Bourne ShellShells – last for nowEnd of Chapter 3.1Chapter 3: ProcessesChapter 3: Processesmodified by your instructormodified by your instructor3.2Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter 3: ProcessesChapter 3: ProcessesProcess ConceptProcess SchedulingOperations on ProcessesCooperating ProcessesInterprocess CommunicationCommunication in Client-Server SystemsThis is a very important chapter now that we have completed the introductory materials.This will require two to three lectures.3.3Silberschatz, Galvin and Gagne ©2005Operating System ConceptsIntroductory Remarks – Introductory Remarks – Quick Review Concepts SlideQuick Review Concepts SlideWe speak of programs and processes. It is important to distinguish between the two.A process is a program in execution; a unit of work.Programs are files stored somewhere – static and passiveA process is executing and needs resources from the computing system such asCPU cyclesMemoryFilesI/O devices.But the operating system is responsible for executing processes and all management of overall resources and those related to processes:Creation / deletion of user and system processes (user code, system code).Process schedulingSynchronization of processes, communication among processes, and the handling of deadlock conditions that can occur among processes.3.4Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess ConceptProcess ConceptAn operating system executes a variety of programs:Batch system – jobsThese usually run from beginning to endTime-shared systems – user programs or tasksEspecially interactive tasking…Textbook uses terms job and process almost interchangeably (for some systems, this is okay, but not all!)Process – a program in executionA process includes:program counter (contained in a CPU register)Current register settingsStack (will see its use ahead)data section – global variables3.5Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess in MemoryProcess in MemoryText – the object code instructionsProgram Counter – address of the next instructionto be fetched from memory, brought intothe CPU, decoded, and executedRegister settings – current values of working registersStack – temporary area for program parameters,return addresses, stack frames (used forrecursion) local variables (specific method)Data – global variables; other data; buffersHeap – (optional) hunk of memory that may be madeavailable for dynamic storage allocation likefor creation of objects and moreWe usually refer to all this as a processes ‘address space.’3.6Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess StateProcess StateAs any process executes, it changes state.All processes have ‘state.’new: The process is being createdrunning: Instructions are being executedwaiting: The process is waiting for some event to occurready: The process is waiting to be assigned to a processterminated: The process has finished executionEven when a process is running, it’s ‘internal’ state is changing! (values of its variables, etc.)3.7Silberschatz, Galvin and Gagne ©2005Operating System ConceptsDiagram of Process StateDiagram of Process StateImportant to note that at any given instant in time, a CPU can only be executing a single instruction from a user or operating system process.Other processes are in other ‘states’ like waiting or ready, or …Discuss states and their transitions3.8Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Control Block (PCB)Process Control Block (PCB)Every process has a PCB – an abstraction of the process itself. Some vendors call PCBs task control blocks (IBM, for example)The PCB is a data structure used to manage the process.It contains: (shown on next slide) everything needed to ‘represent’ the process.Process state – ready, waiting, running, etc.Program counter – address of next instructionCPU registers – instruction registers, stack pointers, index registers, condition-code and/or flag registers….CPU scheduling information – scheduling priorities; specific ‘queues’Memory-management informationBase / limit registers; page tables; segment tables – these depend upon the memory management scheme usedAccounting information – amount of CPU time; memory used, account numbers, time limits, … other resource computations used…I/O status information – list of I/O devices allocated to the process; list of open files, their status, etc.3.9Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Control Block (PCB)Process Control Block (PCB)When a process changes state, say from Running to Wait, the values / contents of the CPU’s registers, instruction counter, etc. are copied into this abstraction of the process to provide for resumption later.All processes have a PCB to represent them and the resources, constraints, temporary values, etc. associated with the process they represent.Used to manage the process – resumption of processing, protection of areas of memory, accounting info and much more.3.10Silberschatz, Galvin and Gagne ©2005Operating System ConceptsCPU Switch From Process to ProcessCPU Switch From Process to ProcessDiscuss “ContextSwitching!”Originating outside or within the process.Note: Or some other Ready process!3.11Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Scheduling QueuesProcess Scheduling QueuesRemember: goal of what we call multiprogramming is to have some process running all the time to maximize CPU utilization;Goal of time sharing is to switch the context from one process to another so users can
View Full Document