Process Concept
Mohammed Nasseh
2021-2022
Process Concept
• A program in execution, is a process.
• A program as a compiler is a process. A word-
processing program being run by an individual
user on a PC is a process.
Process Management
The operating system is responsible for the following
activities in connection with process management:
• Creating and deleting both user and system processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling
Process In Memory
• Informally, as mentioned earlier, a process is a
program in execution.
• text section: the program code
• Program counter: includes the current activity
and the contents of the processor's registers.
• Stack: contains temporary data (such as function
parameters, return addresses, and local variables)
• data section: which contains global variables
• Heap: which is memory that is dynamically
allocated during process run time.
Process in Memory
Processes
• Although two processes may be associated
with the same program, they are considered
two separate execution sequences.
• For example, Same user may invoke many
copies of the web browser program. Each of
these is a separate process; and although the
text sections are equivalent, the data, heap,
and stack sections vary.
Process State
• As a process executes, it changes state. The state of a
process is defined in part by the current activity of that
process.
• New: The process is being created.
• Running: Instructions are being executed.
• Waiting: The process is waiting for some event to occur
(such as an I/O completion or reception of a signal).
• Ready: The process is waiting to be assigned to a
processor.
• Terminated: The process has finished execution.
Diagram of Process State
Process State
• It is important to realize that only one process
can be running on any processor at any
instant.
• Many processes may be ready.
Process Control Block
• Each process is represented in the operating
system by a process control block (PCB)—also
called a task control block.
• It contains many pieces of information
associated with a specific process.
Process Control Block
PCB Contents
• Process state. The state may be new, ready,
running, waiting, and so on.
• Program counter. The counter indicates the
address of the next instruction to be executed
for this process.
• CPU registers. The registers vary in number
and type, depending on the computer
architecture.
PCB Contents (cont.)
• CPU-scheduling information. This information
includes a process priority, pointers to scheduling
queues, and any other scheduling parameters.
• Memory-management information – memory
allocated to the process
• Accounting information – CPU used, clock time
elapsed since start, time limits
• I/O status information – I/O devices allocated to
process, list of open files
CPU Switch From Process to Process