SlideShare a Scribd company logo
1 of 32
CS8493 – Operating
Systems
UNIT II – PROCESS MANAGEMENT
KGiSL INSTITUTE OF TECHNOLOGY
Session Agenda
1. Process Concepts
2. Process Operations, Scheduling, IPC
3. CPU Scheduling – Criteria & Algorithms (3 hours)
6. Multiple Processor & Real-Time Scheduling
7. Threads – Overview, Models & Issues
8. Process Synchronization – CS problem, hardware, mutex locks, semaphores, CR, monitors
9. Deadlock – Model, Characteristics, handling methods
10. Deadlock, prevention & avoidance
11. Deadlock detection & recovery
Recap
Process – Active Entity
Program – Passive Entity
States of Process
Attributes of Process
Brain of Process – PCB (Process Control Block)
Operations on Process
PROCESS CREATION
Processes may create other processes through appropriate system calls, such as fork or spawn.
The process which creates other process is termed as Parent and the process created by parent is called
Child.
Each process is given an integer identifier, termed its process identifier, or PID. The parent PID ( PPID )
is also stored for each process.
On typical UNIX systems the process scheduler is termed sched, and is given PID 0. The first thing it
does at system startup time is to launch init, which gives that process PID 1. Init then launches all system
daemons and user logins, and becomes the ultimate parent of all other processes.
Operations on Process
PROCESS CREATION
Operations on Process
PROCESS CREATION
Depending on system implementation, a child process may receive some amount of
shared resources with its parent.
Child processes may or may not be limited to a subset of the resources originally
allocated to the parent, preventing runaway children from consuming all of a certain
system resource.
Operations on Process
PROCESS CREATION
There are two options for the parent process after creating the child:
Wait for the child process to terminate before proceeding.
Run concurrently with the child, continuing to process without waiting.
Two possibilities for the address space of the child relative to the parent:
The child may be an exact duplicate of the parent, sharing the same program and data segments in
memory. Each will have their own PCB, including program counter, registers, and PID. This is the
behavior of the fork system call in UNIX.
The child process may have a new program loaded into its address space, with all new code and data
segments. This is the behavior of the spawn system calls in Windows.
Operations on Process
PROCESS CREATION
Operations on Process
PROCESS CREATION
Processes may request their own termination by making the exit( ) system
call, typically returning an int.
This int is passed along to the parent if it is doing a wait( ), and is typically
zero on successful completion and some non-zero code in the event of
problems.
Operations on Process
In general, the following are the major operations carried out:
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 - 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.
Deletion/Killing - Once the purpose of the process gets over then the OS will kill the process.
Process Queue & Schedulers
PROCESS QUEUE
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.
Process Queue & Schedulers
PROCESS QUEUE
Process Queue & Schedulers
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.
Process Queue & Schedulers
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.
Process Queue & Schedulers
PROCESS SCHEDULERS – LONG TERM SCHEDULERS
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.
Process Queue & Schedulers
PROCESS SCHEDULERS – SHORT TERM SCHEDULERS
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.
Process Queue & Schedulers
PROCESS SCHEDULERS – MEDIUM TERM SCHEDULERS
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 Queue & Schedulers
PROCESS SCHEDULERS – MEDIUM TERM SCHEDULERS
Inter Process Communication
Independent Processes operating concurrently on a systems are those that can neither affect other processes or be
affected by other processes.
Cooperating Processes are those that can affect or be affected by other processes. There are several reasons why
cooperating processes are allowed:
Information Sharing - There may be several processes which need access to the same file for example. ( e.g.
pipelines. )
Computation speedup - Often a solution to a problem can be solved faster if the problem can be broken down
into sub-tasks to be solved simultaneously ( particularly when multiple processors are involved. )
Modularity - The most efficient architecture may be to break a system down into cooperating modules. ( E.g.
databases with a client-server architecture. )
Convenience - Even a single user may be multi-tasking, such as editing, compiling, printing, and running the
same code in different windows.
Inter Process Communication
Inter Process Communication
Inter Process Communication
Inter Process Communication – Shared
Memory
Shared Memory is faster once it is set up, because no system calls are required and access occurs at normal
memory speeds. However it is more complicated to set up, and doesn't work as well across multiple computers.
Shared memory is generally preferable when large amounts of information must be shared quickly on the same
computer.
In general the memory to be shared in a shared-memory system is initially within the address space of a particular
process, which needs to make system calls in order to make that memory publicly available to one or more other
processes.
Other processes which wish to use the shared memory must then make their own system calls to attach the shared
memory area onto their address space.
Generally a few messages must be passed back and forth between the cooperating processes first in order to set up and
coordinate the shared memory access.
Inter Process Communication – Shared
Memory – producer consumer problem
Paradigm for cooperating processes, producer process produces information that is consumed by a consumer
process
unbounded-buffer places no practical limit on the size of the buffer
bounded-buffer assumes that there is a fixed buffer size
This is a classic example, in which one process is producing data and another process is consuming the data. ( In this
example in the order in which it is produced, although that could vary. )
The data is passed via an intermediary buffer, which may be either unbounded or bounded. With a bounded buffer the
producer may have to wait until there is space available in the buffer, but with an unbounded buffer the producer will
never need to wait. The consumer may need to wait in either case until there is data available.
This example uses shared memory and a circular queue. Note in the code below that only the producer changes "in",
and only the consumer changes "out", and that they can never be accessing the same array location at the same time.
Inter Process Communication – Shared
Memory – producer consumer problem
Inter Process Communication – Shared
Memory – producer consumer problem
producer
Inter Process Communication – Shared
Memory – producer consumer problem
consumer
Inter Process Communication – Message
Passing
Message passing systems must support at a minimum system calls for "send message" and "receive
message".
A communication link must be established between the cooperating processes before messages can be
sent.
There are three key issues to be resolved in message passing systems:
Direct or indirect communication ( naming )
Synchronous or asynchronous communication
Automatic or explicit buffering.
Inter Process Communication – Message
Passing (NAMING)
•With direct communication the sender must know the name of the receiver to which it wishes to send a message.
• There is a one-to-one link between every sender-receiver pair.
• For symmetric communication, the receiver must also know the specific name of the sender from which it wishes to
receive messages.
• For asymmetric communications, this is not necessary.
•Indirect communication uses shared mailboxes, or ports.
• Multiple processes can share the same mailbox or boxes.
• Only one process can read any given message in a mailbox. Initially the process that creates the mailbox is the owner, and
is the only one allowed to read mail in the mailbox, although this privilege may be transferred.
• ( Of course the process that reads the message can immediately turn around and place an identical message back in
the box for someone else to read, but that may put it at the back end of a queue of messages. )
• The OS must provide system calls to create and delete mailboxes, and to send and receive messages to/from mailboxes.
Inter Process Communication – Message
Passing (SYNCHRONIZATION)
Either the sending or receiving of messages ( or neither or both )
may be either blocking or non-blocking.
Inter Process Communication – Message
Passing (Buffering)
•Messages are passed via queues, which may have one of three capacity configurations:
• Zero capacity - Messages cannot be stored in the queue, so senders must block until receivers
accept the messages.
• Bounded capacity- There is a certain pre-determined finite capacity in the queue. Senders
must block if the queue is full, until space becomes available in the queue, but may be either
blocking or non-blocking otherwise.
• Unbounded capacity - The queue has a theoretical infinite capacity, so senders are never
forced to block.
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation

More Related Content

Similar to LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation

Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of ProcessShipra Swati
 
23565104 process-management(2)
23565104 process-management(2)23565104 process-management(2)
23565104 process-management(2)Anuj Malhotra
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2) rohassanie
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its conceptsKaran Thakkar
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process managementArnav Chowdhury
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...ApurvaLaddha
 
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.ppt
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.pptModule-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.ppt
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.pptKAnurag2
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsmanideepakc
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesmanideepakc
 

Similar to LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation (20)

Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of Process
 
23565104 process-management(2)
23565104 process-management(2)23565104 process-management(2)
23565104 process-management(2)
 
Process Management
Process ManagementProcess Management
Process Management
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
 
unit-2.pdf
unit-2.pdfunit-2.pdf
unit-2.pdf
 
Operating system
Operating systemOperating system
Operating system
 
Operating system
Operating systemOperating system
Operating system
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
Processes
ProcessesProcesses
Processes
 
Operating System
Operating SystemOperating System
Operating System
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Operating system
Operating systemOperating system
Operating system
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
Processing management
Processing managementProcessing management
Processing management
 
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.ppt
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.pptModule-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.ppt
Module-6 process managedf;jsovj;ksdv;sdkvnksdnvldknvlkdfsment.ppt
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system calls
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 

More from Mani Deepak Choudhry

L13 Plume Rise, types, methods, applications
L13 Plume Rise, types, methods, applicationsL13 Plume Rise, types, methods, applications
L13 Plume Rise, types, methods, applicationsMani Deepak Choudhry
 
L10 Inversions in atmospheric stability, conditions
L10 Inversions in atmospheric stability, conditionsL10 Inversions in atmospheric stability, conditions
L10 Inversions in atmospheric stability, conditionsMani Deepak Choudhry
 
UNIT II - meteorology, occurrence, process
UNIT II - meteorology, occurrence, processUNIT II - meteorology, occurrence, process
UNIT II - meteorology, occurrence, processMani Deepak Choudhry
 
L11 Wind profiles and stack plume patterns.pptx
L11 Wind profiles and stack plume patterns.pptxL11 Wind profiles and stack plume patterns.pptx
L11 Wind profiles and stack plume patterns.pptxMani Deepak Choudhry
 
LM7 - Ambient Air Quality and Emission standards..pptx
LM7 - Ambient Air Quality and Emission standards..pptxLM7 - Ambient Air Quality and Emission standards..pptx
LM7 - Ambient Air Quality and Emission standards..pptxMani Deepak Choudhry
 
LM16 - Gravity Separators, methods, measures
LM16 - Gravity Separators, methods, measuresLM16 - Gravity Separators, methods, measures
LM16 - Gravity Separators, methods, measuresMani Deepak Choudhry
 
LM14,15 - Air Pollution Control, measures
LM14,15 - Air Pollution Control, measuresLM14,15 - Air Pollution Control, measures
LM14,15 - Air Pollution Control, measuresMani Deepak Choudhry
 
LM9 - Fundamentals, Atmospheric stability.pptx
LM9 - Fundamentals, Atmospheric stability.pptxLM9 - Fundamentals, Atmospheric stability.pptx
LM9 - Fundamentals, Atmospheric stability.pptxMani Deepak Choudhry
 
LM8 - Effects of meteorology on Air Pollution.pptx
LM8 - Effects of meteorology on Air Pollution.pptxLM8 - Effects of meteorology on Air Pollution.pptx
LM8 - Effects of meteorology on Air Pollution.pptxMani Deepak Choudhry
 
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptx
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptxLM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptx
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptxMani Deepak Choudhry
 
LM5 - Effect of air Pollutants on Vegetation & animals.pptx
LM5 - Effect of air Pollutants on Vegetation & animals.pptxLM5 - Effect of air Pollutants on Vegetation & animals.pptx
LM5 - Effect of air Pollutants on Vegetation & animals.pptxMani Deepak Choudhry
 
LM4 - Classification of air pollutants and their effect on human health.pptx
LM4 - Classification of air pollutants and their effect on human health.pptxLM4 - Classification of air pollutants and their effect on human health.pptx
LM4 - Classification of air pollutants and their effect on human health.pptxMani Deepak Choudhry
 
LM2 - Definition, Scope & Scales of Air Pollution.pptx
LM2 - Definition, Scope & Scales of Air Pollution.pptxLM2 - Definition, Scope & Scales of Air Pollution.pptx
LM2 - Definition, Scope & Scales of Air Pollution.pptxMani Deepak Choudhry
 
LM1 - Structure & Composition of Atmosphere.pptx
LM1 - Structure & Composition of Atmosphere.pptxLM1 - Structure & Composition of Atmosphere.pptx
LM1 - Structure & Composition of Atmosphere.pptxMani Deepak Choudhry
 
Safety Terminologies, measures, hazards and risks
Safety Terminologies, measures, hazards and risksSafety Terminologies, measures, hazards and risks
Safety Terminologies, measures, hazards and risksMani Deepak Choudhry
 
Software Configuration Management introduction
Software Configuration Management introductionSoftware Configuration Management introduction
Software Configuration Management introductionMani Deepak Choudhry
 
Meta Safety Data Sheets for hazardous materials
Meta Safety Data Sheets for hazardous materialsMeta Safety Data Sheets for hazardous materials
Meta Safety Data Sheets for hazardous materialsMani Deepak Choudhry
 
Personnel Protective Equipment along with measures
Personnel Protective Equipment along with measuresPersonnel Protective Equipment along with measures
Personnel Protective Equipment along with measuresMani Deepak Choudhry
 
types of testing with descriptions and examples
types of testing with descriptions and examplestypes of testing with descriptions and examples
types of testing with descriptions and examplesMani Deepak Choudhry
 
object oriented testing with types of testing
object oriented testing with types of testingobject oriented testing with types of testing
object oriented testing with types of testingMani Deepak Choudhry
 

More from Mani Deepak Choudhry (20)

L13 Plume Rise, types, methods, applications
L13 Plume Rise, types, methods, applicationsL13 Plume Rise, types, methods, applications
L13 Plume Rise, types, methods, applications
 
L10 Inversions in atmospheric stability, conditions
L10 Inversions in atmospheric stability, conditionsL10 Inversions in atmospheric stability, conditions
L10 Inversions in atmospheric stability, conditions
 
UNIT II - meteorology, occurrence, process
UNIT II - meteorology, occurrence, processUNIT II - meteorology, occurrence, process
UNIT II - meteorology, occurrence, process
 
L11 Wind profiles and stack plume patterns.pptx
L11 Wind profiles and stack plume patterns.pptxL11 Wind profiles and stack plume patterns.pptx
L11 Wind profiles and stack plume patterns.pptx
 
LM7 - Ambient Air Quality and Emission standards..pptx
LM7 - Ambient Air Quality and Emission standards..pptxLM7 - Ambient Air Quality and Emission standards..pptx
LM7 - Ambient Air Quality and Emission standards..pptx
 
LM16 - Gravity Separators, methods, measures
LM16 - Gravity Separators, methods, measuresLM16 - Gravity Separators, methods, measures
LM16 - Gravity Separators, methods, measures
 
LM14,15 - Air Pollution Control, measures
LM14,15 - Air Pollution Control, measuresLM14,15 - Air Pollution Control, measures
LM14,15 - Air Pollution Control, measures
 
LM9 - Fundamentals, Atmospheric stability.pptx
LM9 - Fundamentals, Atmospheric stability.pptxLM9 - Fundamentals, Atmospheric stability.pptx
LM9 - Fundamentals, Atmospheric stability.pptx
 
LM8 - Effects of meteorology on Air Pollution.pptx
LM8 - Effects of meteorology on Air Pollution.pptxLM8 - Effects of meteorology on Air Pollution.pptx
LM8 - Effects of meteorology on Air Pollution.pptx
 
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptx
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptxLM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptx
LM6 - Effect of air Pollutants on Property aesthetic value and visibility.pptx
 
LM5 - Effect of air Pollutants on Vegetation & animals.pptx
LM5 - Effect of air Pollutants on Vegetation & animals.pptxLM5 - Effect of air Pollutants on Vegetation & animals.pptx
LM5 - Effect of air Pollutants on Vegetation & animals.pptx
 
LM4 - Classification of air pollutants and their effect on human health.pptx
LM4 - Classification of air pollutants and their effect on human health.pptxLM4 - Classification of air pollutants and their effect on human health.pptx
LM4 - Classification of air pollutants and their effect on human health.pptx
 
LM2 - Definition, Scope & Scales of Air Pollution.pptx
LM2 - Definition, Scope & Scales of Air Pollution.pptxLM2 - Definition, Scope & Scales of Air Pollution.pptx
LM2 - Definition, Scope & Scales of Air Pollution.pptx
 
LM1 - Structure & Composition of Atmosphere.pptx
LM1 - Structure & Composition of Atmosphere.pptxLM1 - Structure & Composition of Atmosphere.pptx
LM1 - Structure & Composition of Atmosphere.pptx
 
Safety Terminologies, measures, hazards and risks
Safety Terminologies, measures, hazards and risksSafety Terminologies, measures, hazards and risks
Safety Terminologies, measures, hazards and risks
 
Software Configuration Management introduction
Software Configuration Management introductionSoftware Configuration Management introduction
Software Configuration Management introduction
 
Meta Safety Data Sheets for hazardous materials
Meta Safety Data Sheets for hazardous materialsMeta Safety Data Sheets for hazardous materials
Meta Safety Data Sheets for hazardous materials
 
Personnel Protective Equipment along with measures
Personnel Protective Equipment along with measuresPersonnel Protective Equipment along with measures
Personnel Protective Equipment along with measures
 
types of testing with descriptions and examples
types of testing with descriptions and examplestypes of testing with descriptions and examples
types of testing with descriptions and examples
 
object oriented testing with types of testing
object oriented testing with types of testingobject oriented testing with types of testing
object oriented testing with types of testing
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 

LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation

  • 1. CS8493 – Operating Systems UNIT II – PROCESS MANAGEMENT KGiSL INSTITUTE OF TECHNOLOGY
  • 2. Session Agenda 1. Process Concepts 2. Process Operations, Scheduling, IPC 3. CPU Scheduling – Criteria & Algorithms (3 hours) 6. Multiple Processor & Real-Time Scheduling 7. Threads – Overview, Models & Issues 8. Process Synchronization – CS problem, hardware, mutex locks, semaphores, CR, monitors 9. Deadlock – Model, Characteristics, handling methods 10. Deadlock, prevention & avoidance 11. Deadlock detection & recovery
  • 3. Recap Process – Active Entity Program – Passive Entity States of Process Attributes of Process Brain of Process – PCB (Process Control Block)
  • 4. Operations on Process PROCESS CREATION Processes may create other processes through appropriate system calls, such as fork or spawn. The process which creates other process is termed as Parent and the process created by parent is called Child. Each process is given an integer identifier, termed its process identifier, or PID. The parent PID ( PPID ) is also stored for each process. On typical UNIX systems the process scheduler is termed sched, and is given PID 0. The first thing it does at system startup time is to launch init, which gives that process PID 1. Init then launches all system daemons and user logins, and becomes the ultimate parent of all other processes.
  • 6. Operations on Process PROCESS CREATION Depending on system implementation, a child process may receive some amount of shared resources with its parent. Child processes may or may not be limited to a subset of the resources originally allocated to the parent, preventing runaway children from consuming all of a certain system resource.
  • 7. Operations on Process PROCESS CREATION There are two options for the parent process after creating the child: Wait for the child process to terminate before proceeding. Run concurrently with the child, continuing to process without waiting. Two possibilities for the address space of the child relative to the parent: The child may be an exact duplicate of the parent, sharing the same program and data segments in memory. Each will have their own PCB, including program counter, registers, and PID. This is the behavior of the fork system call in UNIX. The child process may have a new program loaded into its address space, with all new code and data segments. This is the behavior of the spawn system calls in Windows.
  • 9. Operations on Process PROCESS CREATION Processes may request their own termination by making the exit( ) system call, typically returning an int. This int is passed along to the parent if it is doing a wait( ), and is typically zero on successful completion and some non-zero code in the event of problems.
  • 10. Operations on Process In general, the following are the major operations carried out: 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 - 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. Deletion/Killing - Once the purpose of the process gets over then the OS will kill the process.
  • 11. Process Queue & Schedulers PROCESS QUEUE 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.
  • 12. Process Queue & Schedulers PROCESS QUEUE
  • 13. Process Queue & Schedulers 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.
  • 14. Process Queue & Schedulers 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.
  • 15. Process Queue & Schedulers PROCESS SCHEDULERS – LONG TERM SCHEDULERS 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.
  • 16. Process Queue & Schedulers PROCESS SCHEDULERS – SHORT TERM SCHEDULERS 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.
  • 17. Process Queue & Schedulers PROCESS SCHEDULERS – MEDIUM TERM SCHEDULERS 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.
  • 18. Process Queue & Schedulers PROCESS SCHEDULERS – MEDIUM TERM SCHEDULERS
  • 19. Inter Process Communication Independent Processes operating concurrently on a systems are those that can neither affect other processes or be affected by other processes. Cooperating Processes are those that can affect or be affected by other processes. There are several reasons why cooperating processes are allowed: Information Sharing - There may be several processes which need access to the same file for example. ( e.g. pipelines. ) Computation speedup - Often a solution to a problem can be solved faster if the problem can be broken down into sub-tasks to be solved simultaneously ( particularly when multiple processors are involved. ) Modularity - The most efficient architecture may be to break a system down into cooperating modules. ( E.g. databases with a client-server architecture. ) Convenience - Even a single user may be multi-tasking, such as editing, compiling, printing, and running the same code in different windows.
  • 23. Inter Process Communication – Shared Memory Shared Memory is faster once it is set up, because no system calls are required and access occurs at normal memory speeds. However it is more complicated to set up, and doesn't work as well across multiple computers. Shared memory is generally preferable when large amounts of information must be shared quickly on the same computer. In general the memory to be shared in a shared-memory system is initially within the address space of a particular process, which needs to make system calls in order to make that memory publicly available to one or more other processes. Other processes which wish to use the shared memory must then make their own system calls to attach the shared memory area onto their address space. Generally a few messages must be passed back and forth between the cooperating processes first in order to set up and coordinate the shared memory access.
  • 24. Inter Process Communication – Shared Memory – producer consumer problem Paradigm for cooperating processes, producer process produces information that is consumed by a consumer process unbounded-buffer places no practical limit on the size of the buffer bounded-buffer assumes that there is a fixed buffer size This is a classic example, in which one process is producing data and another process is consuming the data. ( In this example in the order in which it is produced, although that could vary. ) The data is passed via an intermediary buffer, which may be either unbounded or bounded. With a bounded buffer the producer may have to wait until there is space available in the buffer, but with an unbounded buffer the producer will never need to wait. The consumer may need to wait in either case until there is data available. This example uses shared memory and a circular queue. Note in the code below that only the producer changes "in", and only the consumer changes "out", and that they can never be accessing the same array location at the same time.
  • 25. Inter Process Communication – Shared Memory – producer consumer problem
  • 26. Inter Process Communication – Shared Memory – producer consumer problem producer
  • 27. Inter Process Communication – Shared Memory – producer consumer problem consumer
  • 28. Inter Process Communication – Message Passing Message passing systems must support at a minimum system calls for "send message" and "receive message". A communication link must be established between the cooperating processes before messages can be sent. There are three key issues to be resolved in message passing systems: Direct or indirect communication ( naming ) Synchronous or asynchronous communication Automatic or explicit buffering.
  • 29. Inter Process Communication – Message Passing (NAMING) •With direct communication the sender must know the name of the receiver to which it wishes to send a message. • There is a one-to-one link between every sender-receiver pair. • For symmetric communication, the receiver must also know the specific name of the sender from which it wishes to receive messages. • For asymmetric communications, this is not necessary. •Indirect communication uses shared mailboxes, or ports. • Multiple processes can share the same mailbox or boxes. • Only one process can read any given message in a mailbox. Initially the process that creates the mailbox is the owner, and is the only one allowed to read mail in the mailbox, although this privilege may be transferred. • ( Of course the process that reads the message can immediately turn around and place an identical message back in the box for someone else to read, but that may put it at the back end of a queue of messages. ) • The OS must provide system calls to create and delete mailboxes, and to send and receive messages to/from mailboxes.
  • 30. Inter Process Communication – Message Passing (SYNCHRONIZATION) Either the sending or receiving of messages ( or neither or both ) may be either blocking or non-blocking.
  • 31. Inter Process Communication – Message Passing (Buffering) •Messages are passed via queues, which may have one of three capacity configurations: • Zero capacity - Messages cannot be stored in the queue, so senders must block until receivers accept the messages. • Bounded capacity- There is a certain pre-determined finite capacity in the queue. Senders must block if the queue is full, until space becomes available in the queue, but may be either blocking or non-blocking otherwise. • Unbounded capacity - The queue has a theoretical infinite capacity, so senders are never forced to block.