This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMPSCI 377 Operating Systems Spring 2010 Lecture 4: January 29 Lecturer: Prashant Shenoy TA: Vimal Mathew 4.1 Process State 4.1.1 Process A process is a dynamic instance of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs concurrently. A computer program itself is just a passive collection of instructions, while a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several windows of the same program typically means more than one process is being executed. The state of a process consists of - code for the running program, its static data, its heap and the heap pointer (HP) where dynamic data is kept, program counter, stack and the stack pointer, value of CPU registers, set of OS resources in use (list of open files etc), and the current process execution state (new, ready, running etc). 4.1.2 Process Execution States Processes go through various process states which determine how the process is handled by the operating system kernel. The specific implementations of these states vary in different operating systems, and the names of these states are not standardised, but the general high-level functionality is the same. When a process is first started/created, it is in new state. It needs to wait for the process scheduler (of the operating system) to set its status to new and load it into main memory from secondary storage device (such as a hard disk or a CD-ROM). Once it is loaded into memory it enters the ready state. Once the process has been assigned to a processor by the OS scheduler, a context switch is performed (loading the process into the processor) and the process state is set to running- where the processor executes its instructions. If a process needs to wait for a resource (such as waiting for user input, or waiting for a file to become available), it is moved into the wating state until it no longer needs to wait - then it is moved back into the ready state. Once the process finishes execution, or is terminated by the operating system, it is moved to the terminated state where it waits to be removed from main memory. The OS manages multiple active process using state queues . 4.1.3 Process Control Block A Process Control Block is a data structure in the operating system kernel containing the information needed to manage a particular process. A PCB is created in the kernel whenever a new process is started. The OS maintains a queue of PCBs, one for each process running in the system. A PCB will include: the identifier of the process (a process identifier, or PID); register values for the process including the program counter; the address space for the process; scheduling information such as priority, process accounting information such as when the process was last run, how much CPU time it has accumulated, etc; pointer to the next...
View Full Document
This note was uploaded on 09/30/2010 for the course CS 377 taught by Professor Corner during the Fall '08 term at UMass (Amherst).
- Fall '08
- Operating Systems