Professional Documents
Culture Documents
Operating System Presentation
Operating System Presentation
Operating System Presentation
SYSTEM
PROCESS MANAGEMENT
01 02 03
04 05 06
Introduction
A Program does nothing unless its instructions are executed by a CPU. A program
in execution is called a process. In order to accomplish its task, process needs the
computer resources.
There may exist more than one process in the system which may require the same
resource at the same time. Therefore, the operating system has to manage all the
processes and the resources in a convenient and efficient way.
Some resources may need to be executed by one process at one time to maintain the
consistency otherwise the system can become inconsistent and deadlock may occur.
DEFINITION OF PROCESS
PROCESS
TEXT DATA
Holds the current activities represented Holds the global variables
by the value of Program Counter
STACK HEAP
Holds temporary data such as local variables, Dynamically allocate memory to
functional parameters, return addresses, etc. process during runtime
PROCESS CONTROL BLOCK (PCB)
● The process control block stores the register content also known as execution content of the processor when it was blocked from
running. This execution content architecture enables the operating system to restore a process’s execution context when the
process returns to the running state.
● When the process makes a transition from one state to another, the operating system updates its information in the process’s PCB.
● The operating system maintains pointers to each process’s PCB in a process table so that it can access the PCB quickly.
PROCESS ATTRIBUTES
PROCESS ID
When a process is created, a unique id is assigned to
the process which is used for unique identification of
the process in the system.
PROCESS STATE
The Attributes of the process are used by The Process, from its creation to the completion, goes
the Operating System to create the through various states which are new, ready, running and
process control block (PCB) for each of waiting.
them. This is also called context of the
process. GENERAL PURPOSE REGISTERS
Every process has its own set of registers which
are used to hold the data which is generated
during the execution of the process.
PROCESS ATTRIBUTES
PRIORITY
Every process has its own priority. The process
with the highest priority among the processes LIST OF OPEN FILES
gets the CPU first. This is also stored on the
process control block. During the Execution, Every process uses some
files which need to be present in the main
memory. OS also maintains a list of open files in
the PCB.
RUNNING READY
One of the processes from the ready state will The processes which are ready for the
be chosen by the OS depending upon the execution and reside in the main memory
scheduling algorithm. Hence, If we have are called ready state processes. There can
n processors in the system then we can be many processes present in the ready
have n processes running simultaneously. state.
PROCESS STATES
BLOCK OR WAIT TERMINATION
When a process waits for a certain When a process finishes its execution, it
resource to be assigned or for the comes in the termination state. All the
input from the user then the OS context of the process (Process Control
move this process to the block or Block) will also be deleted the process
wait state and assigns the CPU to the will be terminated by the Operating
other processes. system.
SUSPEND READY
SUSPEND WAIT
A process in the ready state, which is moved
to secondary memory from the main Uses the process which was performing I/O
memory due to lack of the resources operation and lack of main memory
(mainly primary memory) is called in caused them to move to secondary
the suspend ready state. memory. When work is finished, it may
go to suspend ready.
PROCESS OPERATIONS
• CREATION
Once the process is created, it will be ready and come into the ready queue (main memory) and will be
ready for the execution.
• SCHEDULING
Out of the many processes present in the ready queue, the Operating system chooses one process and
start executing it. Selecting the process which is to be executed next, is known as scheduling.
• EXECUTION
Once the process is scheduled for the execution, the processor starts executing it. Process may come to
the blocked or wait state during the execution then in that case the processor starts executing the other
processes.
• DELETION/KILLING
Once the purpose of the process gets over then the OS will kill the process. The Context of the process
(PCB) will be deleted and the process gets terminated by the Operating system.
CONTEXT SWITCHING
• DEFINITION
• The Context switching is a technique or method used by the operating system to switch a process
from one state to another to execute its function using CPUs in the system.
• When switching perform in the system, it stores the old running process's status in the form of
registers and assigns the CPU to a new process to execute its tasks. While a new process is running
in the system, the previous process must wait in a ready queue.
• The execution of the old process starts at that point where another process stopped it. It defines the
characteristics of a multitasking operating system in which multiple processes shared the same CPU
to perform multiple tasks without the need for additional processors in the system.
• 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.
• 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.
• WAITING QUEUE
• When the process needs some IO 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 IO.
CPU SCHEDULING
• In the Uniprogrammming systems like MS DOS, when a process waits for any I/O operation to be done, the CPU
remains idol. This is an overhead since it wastes the time and causes the problem of starvation. However, In
Multiprogramming systems, the CPU doesn't remain idle during the waiting time of the Process and it starts
executing other processes. Operating System has to define which process the CPU will be given.
• In Multiprogramming systems, the Operating system schedules the processes on the CPU to have the maximum
utilization of it and this procedure is called CPU scheduling.
• NEED
• In Multiprogramming, if the long term scheduler picks more I/O bound processes then most of the time, the CPU
remains idol. The task of Operating system is to optimize the utilization of resources.
• If most of the running processes change their state from running to waiting then there may always be a possibility of
deadlock in the system. Hence to reduce this overhead, the OS needs to schedule the jobs to get the optimal
utilization of CPU and to avoid the possibility to deadlock.
INTER PROCESS COMMUNICATION
• DEFINITION
• Inter-process communication is used for exchanging useful information between numerous threads
in one or more processes (or programs).
• In general, Inter Process Communication is a type of mechanism usually provided by the operating
system (or OS).
• The main aim or goal of this mechanism is to provide communications in between several
processes.
• ROLE OF SYNCHRONIZATION
• It is one of the essential parts of inter process communication. Typically, this is provided by inter-process
communication control mechanisms, but sometimes it can also be controlled by communication processes.
• These are the following methods that used to provide the synchronization:
• Mutual Exclusion
• Semaphore
• Barrier
• Spinlock
INTER PROCESS COMMMUNICATION DIFFERENT APPROACHES
INTER PROCESS COMMUNICATION
• DIFFERENT APPROACHES
• These are a few different approaches for Inter- Process Communication:
• Pipes
• Shared Memory
• Message Queue
• Direct Communication
• Indirect communication
• Message Passing
• FIFO
• OTHER APPROACHES
• Socket
• File
• Signal
• NEED
• It helps to speedup modularity
• Computational
• Convenience
CASE STUDY
THANK YOU