Вы находитесь на странице: 1из 24

The Process

Ami Tri Cahyadi

Many definitions have been given for the
process, including
A program in execution
An instance of a program running on a computer
The entity that can be assigned to and executed
on a processor
A unit of activity characterized by a single
sequential thread of execution, a current state,
and an associated set of system resources
Component of Process
An executable program
The associated data needed by the
program (variables,work space, buffers,
The execution context of the program
An address space
A program
A execution engine (program
counter, ...)
Process control block (PCB) with
process identifier (PID)
The execution context, or process
state, is the internal data by which
the OS is able to supervise and control
the process.
This internal information is separated
from the process, because the OS has
information not permitted to the
Classic Process (one
Address Space
Each process views its memory as a
contiguous set of logical memory
addresses. The operating system
manages the translation of logical
addresses to the physical memory
addresses of the computer.
Process Control Block
The process control block is a data structure
for each process holding:
Register values
Logical state
Page map table mapping logical addresses to
physical addresses
Type & location of resources it holds
List of resources it needs
Parent process identification
Security keys
Process Creation
At system boot time, one user level
process is created. In Unix, this process
is called init.
In Windows, it is the System Idle
Process. This process is the parent or
grand-parent of all other processes.
New Child Processes are created by
another process (the Parent Process).
Windows Process Creation
Unix Process Creation
Unix fork() creates a process
Creates a new address space
Copies text, data, & stack into new adress
Provides child with access to open files
Unix exec() allows a child to run a new
Unix wait() allows a parent to wait for a
child to terminate
int pidValue;
pidValue = fork(); /* Creates a child process */
if(pidValue == 0) {
/* pidValue is 0 for child, nonzero for parent */
/* The child executes this code concurrently with parent */
childsPlay(...); /* A procedure linked into a.out */
/* The parent executes this code concurrently with child */
Multi-threaded Process
The simple model of a process containing
only one thread, is referred to as a classic
process. Modern operating systems also
support processes with multiple threads.
Each thread of a single process can use the
process global data with synchronization
resources to easily communicate with other
threads. Multi-threaded programs run more
efficiently and use less resources than a
program that creates multiple processes to
accomplish the same task.
The Process Managers Job
The responsibilities of the process manager
Process creation and termination
Thread creation and termination
Process/thread synchronization
Resource allocation
Resource protection
Cooperation with the device manager to
implement I/O
Implementation of the address space
Process Scheduling
Process Finite State
Simple FSM
Unix FSM
Windows FSM
Process Resource
If a process requests a resource that is already in use, the process is held in a
queue until the resource becomes available.