Académique Documents
Professionnel Documents
Culture Documents
1 Process Concept
1.1
Objectives
This chapter introduces the idea of processes. In particular, we will discuss the definition of
processes and the life cycle of a process.
1.2
Chapter Outline
Process Concept
1.3
Process Concept
CPU Scheduling - when and which process will be given CPU time, as the CPU can only
execute instructions from once process at a time
Resource Allocation - what resources are allocated to processes and when? For
example, what if two processes decide to use the printer at the same time?
Deadlock issue what if two or more processes are waiting for each other to finish and
thus they never do. How should the OS handle this?
These issues are fundamental to any operating system. We will discuss these issues over the
span of the next few chapters.
Operating Systems
J.E.D.I.
1.4
A process undergoes the following life cycle during the course of its execution
Ready: The process is ready for execution. It waits in the ready queue until it is given
CPU time.
Running: The processes is running on the CPU, currently executing program instructions
Terminated: The process has finished execution and is waiting for the OS to deallocate
it from memory and to clear any used resources.
J.E.D.I.
the waiting state. This allows for other processes in the ready queue to run their own CPU
burst, making sure that the CPU is not kept idle as much as possible. After a process has
finished with its I/O burst, it is sent back into the ready queue.
1.5
The process control block is a data structure in the operating system which is used to describe
a process. Mostly, process control blocks contain the following information:
Process identifier usually a number to indicate what process this process control block
refers to.
Register values as a program executes, it changes values in the CPU's registers. The
register values store the current CPU register values
Program counter although this is a register value as well, we give this a special
mention. The program counter indicates the currently executing instruction of the
process.
Address space indicates the space in memory the process is currently allocated.
Process accounting information this includes process priority, the amount of time used
by the process in the CPU, or any additional information needed by the OS
I/O status information list of files or devices being used by the process.
When a process is moved from the running state to the waiting or ready state, the CPU must
perform what is called a context switch. In loading a different process into the CPU for
execution, it must know what the register values are of the entering process, what space in
memory the process resides in, what instruction next to execute, etc. Basically, the OS needs
the complete state of the process so that it will know where to start execution from. This
information is what is stored in that process' PCB.
Of course the exiting process information must also be stored in its PCB so that the CPU will
know where it left off when that process returns to the running state.
Operating Systems