0% found this document useful (0 votes)
11 views6 pages

Process

Uploaded by

recu12121
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
11 views6 pages

Process

Uploaded by

recu12121
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 6

Processes:

Definition:
A process is defined as an entity which represents the basic unit of work to be
implemented in the system.

A process is basically a program in execution. The execution of a process must


progress in a sequential fashion.

Explanation of Process:

1. Text Section: A Process, sometimes known as the Text Section,


also includes the current activity represented by the value of
the Program Counter.
1. Stack: The stack contains temporary data, such as function
parameters, returns addresses, and local variables.
1. Data Section: Contains the global variable.
1. Heap Section: Dynamically allocated memory to process during its
run time.

Attributes or Characteristics of a Process:

A process has the following attributes.


1. Process Id: A unique identifier assigned by the operating system
1. Process State: Can be ready, running, etc.
1. CPU registers: Like the Program Counter (CPU registers must be
saved and restored when a process is swapped in and out of the
CPU)
1. Accounts information: Amount of CPU used for process
execution, time limits, execution ID, etc
1. I/O status information: For example, devices allocated to the
process, open files, etc
1. CPU scheduling information: For example, Priority (Different
processes may have different priorities, for example, a shorter
process assigned high priority in the shortest job first scheduling)
States of Process:

A process is in one of the following states:

1. New: Newly Created Process (or) being-created process.


1. Ready: After the creation process moves to the Ready state, i.e.
the process is ready for execution.
1. Run: Currently running process in CPU (only one process at a time
can be under execution in a single processor)
1. Wait (or Block): When a process requests I/O access.
1. Complete (or Terminated): The process completed its execution.

Process Control Block (PCB):

A Process Control Block is a data structure maintained by the Operating


System for every process. The PCB is identified by an integer process ID
(PID). A PCB keeps all the information needed to keep track of a process as
listed below in the table –
S.N. Information & Description

1 Process State
The current state of the process i.e., whether it is ready, running, waiting, or
whatever.

2 Process privileges
This is required to allow/disallow access to system resources.

3 Process ID
Unique identification for each of the process in the operating system.

4 Pointer
A pointer to parent process.

5 Program Counter
Program Counter is a pointer to the address of the next instruction to be
executed for this process.

6 CPU registers
Various CPU registers where process need to be stored for execution for
running state.

7 CPU Scheduling Information


Process priority and other scheduling information which is required to
schedule the process.

8 Memory management information


This includes the information of page table, memory limits, Segment table
depending on memory used by the operating system.
9 Accounting information
This includes the amount of CPU used for process execution, time limits,
execution ID etc.

10 IO status information
This includes a list of I/O devices allocated to the process.

The architecture of a PCB is completely dependent on Operating System and


may contain different information in different operating systems. Here is a
simplified diagram of a PCB −

The PCB is maintained for a process throughout its lifetime, and is deleted
once the process terminates.
Context switching:
A context switching is the mechanism to store and restore the state or context
of a CPU in Process Control block so that a process execution can be
resumed from the same point at a later time. Using this technique, a context
switcher enables multiple processes to share a single CPU. Context switching
is an essential part of a multitasking operating system features.
When the scheduler switches the CPU from executing one process to execute
another, the state from the current running process is stored into the process
control block. After this, the state for the process to run next is loaded from its
own PCB and used to set the PC, registers, etc. At that point, the second
process can start executing.
Context switches are computationally intensive since register and memory
state must be saved and restored. To avoid the amount of context switching
time, some hardware systems employ two or more sets of processor registers.
When the process is switched, the following information is stored for later use.

 Program Counter
 Scheduling information
 Base and limit register value
 Currently used register
 Changed State
 I/O State information
 Accounting information

You might also like