OS Part 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Definition of Process:

Basically, a process is a simple program.


An active program which running now on the Operating System is known as the process. The
Process is the base of all computing things. Although process is relatively similar to the
computer code but, the method is not the same as computer code. A process is a "active" entity,
in contrast to the program, which is sometimes thought of as some sort of "passive" entity. The
properties that the process holds include the state of the hardware, the RAM, the CPU, and
other attributes.
A process is actively running software or a computer code. Any procedure must be carried out
in a precise order. An entity that helps in describing the fundamental work unit that must be
implemented in any system is referred to as a process.
In other words, we create computer programs as text files that, when executed, create processes
that carry out all of the tasks listed in the program.
When a program is loaded into memory, it may be divided into the four components stack,
heap, text, and data to form a process. The simplified depiction of a process in the main memory
is shown in the diagram below.

Stack
The process stack stores temporary information such as method or function arguments, the
return address, and local variables.
Heap
This is the memory where a process is dynamically allotted while it is running.
Text
This consists of the information stored in the processor's registers as well as the most recent
activity indicated by the program counter's value.
Data
In this section, both global and static variables are discussed.
Program
Program is a set of instructions which are executed when the certain task is allowed to complete
that certain task. The programs are usually written in a Programming Language like C, C ++,
Python, Java, R, C # (C sharp), etc.

A computer program is a set of instructions that, when carried out by a computer, accomplish
a certain task

Difference between process and the program:

S. Process Program
No

1 A process is actively running software or a computer Program is a set of


code. Any procedure must be carried out in a precise instructions which are
order. An entity that helps in describing the executed when the certain
fundamental work unit that must be implemented in task is allowed to complete
any system is referred to as a process that certain task

2 Process is Dynamic in Nature Program is Static in Nature

3 Process is an Active in Nature Program is Passive in Nature

4 Process is created during the execution and it is Program is already existed in


loaded directly into the main memory the memory and it is present
in the secondary memory.

5 Process has its own control system known as Process Program does not have any
Control Block control system. It is just
called when specified and it
executes the whole program
when called

6 Process changes from time to time by itself Program cannot be changed


on its own. It must be
changed by the programmer.

7 A process needs extra data in addition to the program Program is basically divided
data needed for management and execution. into two parts. One is Code
part and the other part is data
part.

8 Processes have significant resource demands; they A program just needs


require resources like Memory Addresses, Central memory space to store its
Processing Unit, Input or Output until their presence instructions; no further
or existence in the Operating System. resources are needed.

Process Control Block


An Operating System helps in process creation, scheduling, and termination with the help of
Process Control Block. The Process Control Block (PCB), which is part of the Operating
System, aids in managing how processes operate. Every OS process has a Process Control
Block related to it. By keeping data on different things including their state, I/O status, and
CPU Scheduling, a PCB maintains track of processes.
Now, let us understand the Process Control Block with the help of the components present in
the Process Control Block.
A Process Control Block consists of :
1. Process ID
2. Process State
3. Program Counter
4. CPU Registers
5. CPU Scheduling Information
6. Accounting and Business Information
7. Memory Management Information
8. Input Output Status Information
Now, let us understand about each and every component in detail now.
1) Process ID
It is a Identification mark which is present for the Process. This is very useful for finding the
process. It is also very useful for identifying the process also.
2) Process State
Now, let us know about each and every process states in detail. Let me explain about each and
every state
i) New State
A Program which is going to be taken up by the Operating System directly into the Main
Memory is known as a New Process State
ii) Ready State
The ready state, when a process waits for the CPU to be assigned, is the first state it enters after
being formed. The operating system pulls new processes from secondary memory and places
them all in main memory.
The term "ready state processes" refers to processes that are in the main memory and are
prepared for execution. Numerous processes could be active at the moment.
iii) Running State
The Operating System will select one of the processes from the ready state based on the
scheduling mechanism. As a result, if our system only has one CPU, there will only ever be
one process operating at any given moment. We can execute n processes concurrently in the
system if there are n processors.
iv) Waiting or Blocking State
Depending on the scheduling mechanism or the inherent behavior of the process, a process can
go from the Running state to the Block or Wait states.
The OS switches a process to the block or wait state and allots the CPU to the other processes
while it waits for a specific resource to be allocated or for user input.
v) Terminated State
A process enters the termination state once it has completed its execution. The operating system
will end the process and erase the whole context of the process (Process Control Block).
3) Program Counter
The address of the following instruction to be executed from memory is stored in a CPU register
called a program counter (PC) in the computer processor. It is a digital counter required for
both task execution speed and for monitoring the present stage of execution.
An instruction counter, instruction pointer, instruction addresses register, or sequence control
register are other names for a program counter.
4) CPU Registers
When the process is in a running state, here is where the contents of the processor registers are
kept. Accumulators, index and general-purpose registers, instruction registers, and condition
code registers are the many categories of CPU registers.
5) CPU Scheduling Information
It is necessary to arrange a procedure for execution. This schedule determines when it
transitions from ready to running. Process priority, scheduling queue pointers (to indicate the
order of execution), and several other scheduling parameters are all included in CPU
scheduling information.
6) Accounting and Business Information
The State of Business Addressing and Information includes information such as CPU use, the
amount of time a process uses in real time, the number of jobs or processes, etc.
7) Memory Management Information
The Memory Management Information section contains information on the page, segment
tables, and the value of the base and limit registers. It relies on the operating system's memory
system.
8) Input Output Status Information
This Input Output Status Information section consists of Input and Output related information
which includes about the process statuses, etc.

You might also like