Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Process Intro

The document provides an overview of processes in modern computer systems, defining a process as a program in execution with various states such as New, Ready, Run, Wait, Complete, Suspended Ready, and Suspended Block. It discusses the structure of a Process Control Block (PCB) that contains essential information for process management and highlights the concepts of concurrent and parallel processing, as well as Inter Process Communication (IPC) methods like shared memory and message passing. The document emphasizes the importance of processes in multitasking environments and their management by the operating system.

Uploaded by

unik89025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

Process Intro

The document provides an overview of processes in modern computer systems, defining a process as a program in execution with various states such as New, Ready, Run, Wait, Complete, Suspended Ready, and Suspended Block. It discusses the structure of a Process Control Block (PCB) that contains essential information for process management and highlights the concepts of concurrent and parallel processing, as well as Inter Process Communication (IPC) methods like shared memory and message passing. The document emphasizes the importance of processes in multitasking environments and their management by the operating system.

Uploaded by

unik89025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction to processes

Early computer system allowed any one program to be executed at a


once, current days computer system allow multiple programs to be
loaded in memory and to be executed at the same time or step by step.
This executing multiple programs is being resulted as process. A process
is the unit of work in a modern time-sharing system.

What is a Process?
A process is a program in execution. Process is not as same as program
code but a lot more than it. A process is an 'active' entity as opposed to
program which is considered to be a 'passive' entity. Attributes held by
process include hardware state, memory, CPU etc.

When a program is loaded into the memory and it becomes a process, it


can be divided into four sections ─ stack, heap, text and data. The
following image shows a simplified layout of a process inside main
memory.

Process memory is divided into four sections for efficient working:

• The Text section is made up of the compiled program code, read


in from non-volatile storage when the program is launched.
• The Data section is made up of the global and static variables,
allocated and initialized prior to executing the main.
• The Heap is used for the dynamic memory allocation, and is
managed via calls to new, delete, malloc, free, etc.
• The Stack is used for local variables. Space on the stack is
reserved for local variables when they are declared.

States of Process:
A process is in one of the following states:

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


which is going to be picked up by the OS into the main memory is called
a new process.
2. Ready: After creation process moves to Ready state, i.e. the process
is ready for execution. Whenever a process is created, it directly enters
in the ready state, in which, it waits for the CPU to be assigned. The OS
picks the new processes from the secondary memory and put all of
them in the main memory.

The processes which are ready for the execution and reside in the
main memory are called ready state processes. There can be many
processes present in the ready state.

3. Run: Currently running process in CPU (only one process at


a time can be under execution in a single processor).One of the
processes from the ready state will be chosen by the OS depending upon
the scheduling algorithm. Hence, if we have only one CPU in our
system, the number of running processes for a particular time will
always be one. If we have n processors in the system then we can have n
processes running simultaneously.

4. Wait (or Block): When a process requests I/O access. When a


process waits for a certain resource to be assigned or for the input from
the user then the OS move this process to the block or wait state and
assigns the CPU to the other processes.

5. Complete (or terminated): The process completed its execution.


When a process finishes its execution, it comes in the termination state.
All the context of the process (Process Control Block) will also be
deleted the process will be terminated by the Operating system.

6. Suspended Ready: When the ready queue becomes full, some


processes are moved to suspended ready state. A process in the ready
state, which is moved to secondary memory from the main memory due
to lack of the resources (mainly primary memory) is called in the
suspend ready state.

If the main memory is full and a higher priority process comes for the
execution then the OS have to make the room for the process in the main
memory by throwing the lower priority process out into the secondary
memory. The suspend ready processes remain in the secondary memory
until the main memory gets available.

7. Suspended Block: When waiting queue becomes full.Instead of


removing the process from the ready queue, it's better to remove the
blocked process which is waiting for some resources in the main
memory. Since it is already waiting for some resource to get available
hence it is better if it waits in the secondary memory and makes room
for the higher priority process. These processes complete their execution
once the main memory gets available and their wait is finished.
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. There is a Process Control Block for each process, enclosing all
the information about the process. It is a data structure, which contains
the following:

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, 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.
Concurrent process
Two processes are said to be concurrent if their execution can overlap in
the time i.e.the execution of second process starts before the first

completes. Typically, the processor will be executing instructions for

one program while another (or several other) program(s) are waiting for
I/O from external devices or from an end-user.

Parallel processing
Simultaneous use of more than one CPU or processors to execute a
program or multiple computation threads. Parallel Processing
Systems are designed to speed up the execution of programs by dividing
the program into multiple fragments and processing these fragments
simultaneously. Such systems are multiprocessor systems also known as
tightly coupled systems. Parallel systems deal with the simultaneous use
of multiple computer resources that can include a single computer with
multiple processors.

Inter Process Communication (IPC)


A process can be of two types:

• Independent process.
• Co-operating process.
An independent process is not affected by the execution of other
processes while a co-operating process can be affected by other
executing processes. Though one can think that those processes, which
are running independently, will execute very efficiently but in practical,
there are many situations when co-operative nature can be utilized for
increasing computational speed, convenience and modularity. Inter
process communication (IPC) is a mechanism which allows processes to
communicate each other and synchronize their actions. The
communication between these processes can be seen as a method of co-
operation between them. Processes can communicate with each other
using these two ways:

1. Shared Memory
2. Message passing

An operating system can implement both method of communication.


Communication between processes using shared memory requires
processes to share some or memory. One way of communication using
shared memory can be imagined like this: Suppose process1 and
process2 are executing simultaneously and they share some resources or
use some information from other process, process1 generate information
about certain computations or resources being used and keeps it as a
record in shared memory. When process2 need to use the shared
information, it will check in the record stored in shared memory and take
note of the information generated by process1 and act accordingly.
Processes can use shared memory for extracting information as a record
from other process as well as for delivering any specific
informationtoother process.

Message Passing Method

In this method, processes communicate with each other without using


any kind of shared memory. If two processes p1 and p2 want to
communicate with each other, they proceed as follow:

• Establish a communication link (if a link already exists, no need to


establish it again.)
• Start exchanging messages using basic primitives.
We need at least two primitives:
– send(message, destination) or send(message)
– receive(message, host) or receive(message)

You might also like