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

PROCESS Notes

A process represents a program in execution and progresses sequentially through instructions. It consists of four sections in memory: the stack, heap, text, and data. A process changes states during execution such as new, ready, running, waiting, and terminated. The operating system uses process control blocks and queues like job, ready, and waiting queues to manage processes and their states. Key process times include arrival time, burst time, completion time, turnaround time, waiting time, and response time.

Uploaded by

Bhomik-116
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)
18 views6 pages

PROCESS Notes

A process represents a program in execution and progresses sequentially through instructions. It consists of four sections in memory: the stack, heap, text, and data. A process changes states during execution such as new, ready, running, waiting, and terminated. The operating system uses process control blocks and queues like job, ready, and waiting queues to manage processes and their states. Key process times include arrival time, burst time, completion time, turnaround time, waiting time, and response time.

Uploaded by

Bhomik-116
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

Process

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

A process is defined as an entity which represents the basic unit of work to be implemented in the
system. We write our computer programs in a text file and when we execute this program, it becomes
a process which performs all the tasks mentioned in the program.

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 −

S.N. Component & Description


1 Stack

The process Stack contains the temporary data such as method/function parameters, return
address and local variables.
2 Heap

This is dynamically allocated memory to a process during its run time.


3 Text

This includes the current activity represented by the value of Program Counter and the
contents of the processor's registers.
4 Data

This section contains the global and static variables.

Program

A program is a piece of code which may be a single line or millions of lines. A computer program is
usually written by a computer programmer in a programming language. For example, here is a simple
program written in C programming language −

#include <stdio.h>

int main() {
printf("Hello, World! \n");
return 0;
}

A computer program is a collection of instructions that performs a specific task when executed by a
computer. When we compare a program with a process, we can conclude that a process is a dynamic
instance of a computer program.

A part of a computer program that performs a well-defined task is known as an algorithm. A collection
of computer programs, libraries and related data are referred to as a software.

Process States

A process changes its state as it executes. This state partially depends on the current activity
of a process. The different states that a process is in during its execution are explained using
the following diagram −

The following are the states −

 New - The process is in the new state when it has just been created.
 Ready - The process is waiting to be assigned the processor by the short-term
scheduler.
 Running - The process instructions are being executed by the processor.
 Waiting - The process is waiting for some event such as I/O to occur.
 Terminated - The process has completed its execution.

Process Control Block

A process control block is associated with each of the processes. It contains important
information about the process it is associated with. Some of this information is as follows −
The following comes under PCB −

 Process State - This specifies the process state i.e. new, ready, running, waiting or
terminated.
 Process Number - This shows the number of the particular process.
 Program Counter - This contains the address of the next instruction that needs to be
executed in the process.
 Registers - This specifies the registers that are used by the process. They may include
accumulators, index registers, stack pointers, general purpose registers etc.
 List of open files - These are the different files that are associated with the process.
 Operating system uses various schedulers for the process scheduling described below.

Long term scheduler

Long term scheduler is also known as job scheduler. It chooses the processes from the pool
(secondary memory) and keeps them in the ready queue maintained in the primary memory.

Long Term scheduler mainly controls the degree of Multiprogramming. The purpose of
long term scheduler is to choose a perfect mix of IO bound and CPU bound processes
among the jobs present in the pool.

If the job scheduler chooses more IO bound processes then all of the jobs may reside in the
blocked state all the time and the CPU will remain idle most of the time. This will reduce
the degree of Multiprogramming. Therefore, the Job of long term scheduler is very critical
and may affect the system for a very long time.

2. Short term scheduler

Short term scheduler is also known as CPU scheduler. It selects one of the Jobs from the
ready queue and dispatch to the CPU for the execution.
A scheduling algorithm is used to select which job is going to be dispatched for the
execution. The Job of the short term scheduler can be very critical in the sense that if it
selects job whose CPU burst time is very high then all the jobs after that, will have to wait
in the ready queue for a very long time.

This problem is called starvation which may arise if the short term scheduler makes some
mistakes while selecting the job.

3. Medium term scheduler

Medium term scheduler takes care of the swapped out processes. If the running state
processes needs some IO time for the completion then there is a need to change its state
from running to waiting.

Medium term scheduler is used for this purpose. It removes the process from the running
state to make room for the other processes. Such processes are the swapped out processes
and this procedure is called swapping. The medium term scheduler is responsible for
suspending and resuming the processes.

It reduces the degree of multiprogramming. The swapping is necessary to have a perfect


mix of processes in the ready queue.

Process Queues
The Operating system manages various types of queues for each of the process states. The
PCB related to the process is also stored in the queue of the same state. If the Process is
moved from one state to another state then its PCB is also unlinked from the corresponding
queue and added to the other state queue in which the transition is made.

There are the following queues maintained by the Operating system.


1. Job Queue

In starting, all the processes get stored in the job queue. It is maintained in the secondary
memory. The long term scheduler (Job scheduler) picks some of the jobs and put them in the
primary memory.

2. Ready Queue

Ready queue is maintained in primary memory. The short term scheduler picks the job from
the ready queue and dispatch to the CPU for the execution.

3. Waiting Queue

When the process needs some I/O operation in order to complete its execution, OS changes
the state of the process from running to waiting. The context (PCB) associated with the
process gets stored on the waiting queue which will be used by the Processor when the
process finishes the I/O.

Various Times related to the Process

1. Arrival Time

The time at which the process enters into the ready queue is called the arrival time.

2. Burst Time

The total amount of time required by the CPU to execute the whole process is called the
Burst Time. This does not include the waiting time. It is confusing to calculate the execution
time for a process even before executing it hence the scheduling problems based on the burst
time cannot be implemented in reality.

3. Completion Time

The Time at which the process enters into the completion state or the time at which the
process completes its execution, is called completion time.

4. Turnaround time

The total amount of time spent by the process from its arrival to its completion, is called
Turnaround time.

5. Waiting Time

The Total amount of time for which the process waits for the CPU to be assigned is called
waiting time.

6. Response Time

The difference between the arrival time and the time at which the process first gets the CPU
is called Response Time.

You might also like