0% found this document useful (0 votes)
27 views34 pages

Process Management

The document discusses process management in operating systems. It describes what a process is, the different states a process can be in like ready, running, waiting, etc. It also explains process scheduling queues, process control blocks that contain information about processes, and reasons for creating and terminating processes.

Uploaded by

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

Process Management

The document discusses process management in operating systems. It describes what a process is, the different states a process can be in like ready, running, waiting, etc. It also explains process scheduling queues, process control blocks that contain information about processes, and reasons for creating and terminating processes.

Uploaded by

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

PROCESS MANAGEMENT

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

• A program is a passive entity, such as a file containing a list of instructions


stored on disk.

• A process will need certain resources—such as CPU time, memory, files, and
I/O devices — to accomplish its task.
CONT.

• These resources are allocated to the process either when it is created or while
it is executing.

• 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.
CONT.

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.
PROCESS LIFE CYCLE

• When a process executes, it passes through different states. These stages may
differ in different operating systems, and the names of these states are also
not standardized.

• A process can have one of the following five states at a time.


CONT.
• Start:
• This is the initial state when a process is first started/created.

• Ready:
• The process is waiting to be assigned to a processor.

• Ready processes are waiting to have the processor allocated to them by the
operating system so that they can run.
CONT.

• Process may come into this state after Start state or while running it may be
interrupted by the scheduler to assign CPU to some other process.

• Running:
• Once the process has been assigned to a processor by the OS scheduler, the
process state is set to running and the processor executes its instructions.
CONT.

• Waiting:
• Process moves into the waiting state if it needs to wait for a resource, such as
waiting for user input, or waiting for a file to become available.

• Terminated or Exit
• Once the process finishes its execution, or it is terminated by the operating
system, it is moved to the terminated state where it waits to be removed
from main memory.
TWO STATE PROCESS

• The operating systems principal responsibility is controlling the execution of


processes; this includes determining the interleaving pattern for execution and
allocating resources to processes.

• The first step in designing an OS to control processes is to describe the


behavior that we would like the processes to exhibit.
CONT.

• We can construct the simplest possible model by observing that, at any time,
a process is either being executed by a processor, or it isn’t. In this model, a
process may be in one of the two states: Running or Not Running.
CONT.
• When the OS creates a new process, it creates a process control block (PCB)
for the process and enters that process into the system in the Not Running
state. The process exists, is known to the OS, and is waiting for an opportunity
to execute.

• From time to time, the currently running process will be interrupted, and the
dispatcher portion of the OS will select some other process to run. The former
process moves from the Running state to the Not Running state, and one of the
other processes moves to the Running state.
TWO STATE PROCESS MODEL
DIAGRAMMATIC REPRESENTATION OF PROCESS
STATE
CONT.
THE CREATION AND TERMINATION OF
PROCESSES

• The main operation on processes is to create a new one. The―process create‖


call can be used to create a new process. When a user initiates to execute a
program, the operating system creates a process to represent the execution of
the program.
REASONS FOR PROCESS CREATION
CONT.
• An application process may generate another process to receive data that the
application is generating, and to organize those data into a form suitable for
later analysis. The new process runs in parallel to the original process and is
activated from time to time when new data are available. This arrangement can
be very useful in structuring the application.

• As another example, a server process (e.g., print server, file server) may
generate a new process for each request that it handles. When the OS creates a
process at the explicit request of another process, the action is referred to as
process spawning.
CONT

• When one process spawns another, the former is referred to as the parent
process, and the spawned process is referred to as the child process.
Typically, the “related” processes need to communicate and cooperate with
each other.
PROCESS TERMINATION

• Any computer system must provide a means for a process to indicate its completion.
A batch job should include a Halt instruction or an explicit OS service call for
termination. In the former case, the Halt instruction will generate an interrupt to
alert the OS that a process has completed.

• For an interactive application, the action of the user will indicate when the process is
completed. For example, in a time-sharing system, the process for a particular user is to be
terminated when the user logs off or turns off his or her terminal. On a personal computer or
workstation, a user may quit an application (e.g., word processing or spreadsheet). All of these
actions ultimately result in a service request to the OS to terminate the requesting process.
REASONS FOR PROCESS TERMINATION
CONT.
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 −
CONT.

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

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

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

• Pointer
• A pointer to parent process.

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

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

• CPU Scheduling Information


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

• Memory management information


• This includes the information of page table, memory limits, Segment table
depending on memory used by the operating system.

• Accounting information
• This includes the amount of CPU used for process execution, time limits,
execution ID etc.
CONT.

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

• The PCB is maintained for a process throughout its lifetime, and is deleted
once the process terminates.
PROCESS CONTROL BLOCK
PROCESS SCHEDULING

• The process scheduling is the activity of the process manager that handles the
removal of the running process from the CPU and the selection of another process
on the basis of a particular strategy ie scheduling algorithm.

• Process scheduling is an essential part of a Multiprogramming operating systems.


CONT.

• Such operating systems allow more than one process to be loaded into the
executable memory at a time and the loaded process shares the CPU using
time multiplexing.
PROCESS SCHEDULING QUEUES

• The OS maintains all PCBs in Process Scheduling Queues.

• The OS maintains a separate queue for each of the process states and PCBs of
all processes in the same execution state are placed in the same queue.

• When the state of a process is changed, its PCB is unlinked from its current
queue and moved to its new state queue.
CONT.

• The Operating System maintains the following important process scheduling


queues:

• Job queue - This queue keeps all the processes in the system.

• Ready queue - This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.
CONT.

• Device queues - The processes which are blocked due to unavailability of an


I/O device constitute this queue.
DIAGRAM SHOWING PROCESS SCHEDULING
QUEUE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy