SlideShare a Scribd company logo
1 of 23
Download to read offline
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 1
Chapter 2: Processes
Process Concept
Process States
Process Control Block(PCB)
Process Scheduling
Operations on Processes
Cooperating Processes
Inter process Communication
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 2
Process Concept
An operating system executes a variety of programs:
 Batch system – jobs
 Time-shared systems – user programs or tasks
The terms job and process are almost interchangeable.
Process – a program in execution or manipulation
A process has the attributes(properties) of
 program counter
Is used to keep track of the address
0f the next instruction to be executed.
 Stack: Is used to store temporary data for the process.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 3
Five State Process Model
As a process executes, it changes
state
 new: The process is being
created.
 ready: The process is waiting
to be assigned to a process.
 running: Instructions are
being executed.
 waiting: The process is
waiting for some event to
occur.
 terminated: The process has
finished execution.
OperatingSystem02..(B.SC Part 2)
State Transition in Process
New to Ready: Admitted to Ready queue, can be considered by
CPU scheduler
Ready to Running: To be executed next for processing
Running to Ready: Process has used its current time slice
Running to Blocked: Process is waiting for some event to
occur.e.g I/O operation to complete.
Blocked to Ready: Whatever event the process was waiting has
occurred.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 5
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 6
Process Control Block (PCB)
It is a data structure that contains all
the information for a process to be
used for controlling its execution and
the resources used for that process.
Every process has its own PCB.
Information associated with each
process.
Process state (Ready, running, wait)
Program counter (Points to the next
instruction to be executed)
CPU registers(Data is stored in
registers after Interrupt occurs )
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 7
•CPU scheduling information: It holds the
information such as process priority.
•Memory-management information
(information such as base register, page
table etc)
•Accounting information: ( Holds the
amount of CPU time, process to date, or
process number)
•I/O status information: (Holds the list of
I/O devices)
Process Scheduling
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 8
Technique used where there are limited resources and many
processes competing for them.
This is needed when there are more processes and one
processor.
In this way some processes will have to wait until CPU
becomes available. If there are more processes then the
operating system must schedule the process. Many
techniques are used for this purpose.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 9
Process Scheduling Queues
Job queue – set of all processes in the system.
Ready queue – set of all processes residing in main
memory, ready and waiting to execute.
Device queues – set of processes waiting for an I/O
device.
Process migration between
various queues
The process of moving between various
queues is known as Process migration.
i.e moving between ready, waiting and
possibly job queues and finally job finishes the
task.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 10
CPU Scheduler
Selects from among the processes in memory
that are ready to execute, and allocates the
CPU to one of them.
 Non-preemptive Scheduling
 Once CPU has been allocated to a process, the
process keeps the CPU until
 Process exits
 Preemptive Scheduling
 Process can be interrupted and must release the
CPU after time slice terminates.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 12
Schedulers
Long-term scheduler (or job scheduler) –
selects which processes should be brought from
job queue into the ready queue. Processes are
added to the system much less frequently then
processes are swapped between the ready queue
and CPU.The long term scheduler controls the
degree of multiprogramming. Long term
scheduler should select a good process mix of
processes to better the system performance. It
is also called as job scheduling.
Scheduler
LTS STS
JOB
QUEUE
READY
QUEUE
CPU
MAIN
MEMORY
SECONDARY
STORAGE
SHORT-TERM SCHEDULER:
(or CPU scheduler) – selects which process should
be executed next and allocates CPU. It selects a
process from ready queue and gives the control of
CPU to that process. Processes gets the CPU for a
short time slice while the short time scheduler
decides that which job well run next.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 14
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 15
Medium Term Scheduling
Time sharing OSs may introduce a medium term
scheduler
Removes processes from memory to reduce the degree
of multiprogramming
It swaps the process between memory and secondary
storage. It improves the system by reducing the degree
of multiprogramming.
I/O-bound process – spends more time doing I/O than
computations.
CPU-bound process – spends more time doing
computations.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 16
Context Switch
When the CPU switches to another process, an
interrupt occurs.
The system must save the state of the old process
and load the saved state for the new process.
Context-switch time is overhead; the system does
no useful work while switching.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 17
Process Creation
Parent process create children processes which, in turn,
create other processes forming a tree of processes.
Each process is assigned a unique process identifier (pid)
Resource sharing
 Parent and children share all resources.
 Children share subset of parent’s resources.
Execution
 Parent and children execute concurrently.
 Parent waits until some or all of its children terminate.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 18
Process Termination
Process executes last statement and asks the
operating system to delete it by using the exit
 Time Slot finished
 Process’ resources are deal located by operating system.
Parent may terminate execution of children processes
 Child has exceeded allocated resources.
 Task assigned to child is no longer required.
 Parent is exiting.
 Some operating systems do not allow child to continue if its
parent terminates
Inter Process Communication
An IPC is used to provide two operations of sending
and receiving message. If two process wish two
communicate with each other.
 Establish a communication link between them.
 Exchange messages using the send and receive
operations.
 To synchronize there actions
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 19
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 20
Direct Communication
Processes must name each other explicitly (a
disadvantage):
 send (P, message) – send a message to process P
 receive(Q, message) – receive a message from process Q
Properties of communication link
 Links are established automatically.
 A link is associated with exactly one pair of communicating
processes.
 Between each pair there exists exactly one link.
 The link may be unidirectional, but is usually bi-directional.
 the print server.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 21
Indirect Communication
Messages are directed and received from mailboxes
(also referred to as ports).
 Each mailbox has a unique id.
 Processes can communicate only if they share a mailbox.
Properties of communication link
 Link established only if processes share a common mailbox
 A link may be associated with many processes.
 Each pair of processes may share several communication
links.
 Link may be unidirectional or bi-directional.
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 22
Buffering(RAM)
Whether the communication link is direct or
indirect, messages exchanged by communicating
processes resides in a temporary queue.
e.g Copy, Paste
Bounded capacity
Unbounded capacity
Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 23

More Related Content

What's hot

Operating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesOperating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesPeter Tröger
 
Process creation and termination In Operating System
Process creation and termination In Operating SystemProcess creation and termination In Operating System
Process creation and termination In Operating SystemFarhan Aslam
 
Operating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System StructuresOperating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System Structurescscarcas
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringYogesh Santhan
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzGiulianoRanauro
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threadscscarcas
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process managementBabasab Patil
 
Process concept
Process conceptProcess concept
Process conceptjangezkhan
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabadEdhole.com
 
Concurrent process
Concurrent processConcurrent process
Concurrent processYogendra Rwl
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating systemChetan Mahawar
 

What's hot (18)

Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
Operating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - ProcessesOperating Systems 1 (6/12) - Processes
Operating Systems 1 (6/12) - Processes
 
Bt0070
Bt0070Bt0070
Bt0070
 
Process
ProcessProcess
Process
 
Process creation and termination In Operating System
Process creation and termination In Operating SystemProcess creation and termination In Operating System
Process creation and termination In Operating System
 
Operating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System StructuresOperating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System Structures
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
 
Os task
Os taskOs task
Os task
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process management
 
Process concept
Process conceptProcess concept
Process concept
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabad
 
OS Chapter03
OS Chapter03OS Chapter03
OS Chapter03
 
Concurrent process
Concurrent processConcurrent process
Concurrent process
 
Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 

Similar to OperatingSystem02..(B.SC Part 2)

Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptMohammad Almuiet
 
CHAPTER READING TASK OPERATING SYSTEM
CHAPTER READING TASK OPERATING SYSTEMCHAPTER READING TASK OPERATING SYSTEM
CHAPTER READING TASK OPERATING SYSTEMNur Atiqah Mohd Rosli
 
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...Nur Atiqah Mohd Rosli
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationMani Deepak Choudhry
 
cs8493 - operating systems unit 2
cs8493 - operating systems unit 2cs8493 - operating systems unit 2
cs8493 - operating systems unit 2SIMONTHOMAS S
 
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...SanjeevKumarSinha13
 

Similar to OperatingSystem02..(B.SC Part 2) (20)

Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
unit-2.pdf
unit-2.pdfunit-2.pdf
unit-2.pdf
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
CH03.pdf
CH03.pdfCH03.pdf
CH03.pdf
 
CHAPTER READING TASK OPERATING SYSTEM
CHAPTER READING TASK OPERATING SYSTEMCHAPTER READING TASK OPERATING SYSTEM
CHAPTER READING TASK OPERATING SYSTEM
 
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
 
ch3_smu.ppt
ch3_smu.pptch3_smu.ppt
ch3_smu.ppt
 
ch3 (1).ppt
ch3 (1).pptch3 (1).ppt
ch3 (1).ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Lecture_Process.ppt
Lecture_Process.pptLecture_Process.ppt
Lecture_Process.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
cs8493 - operating systems unit 2
cs8493 - operating systems unit 2cs8493 - operating systems unit 2
cs8493 - operating systems unit 2
 
Processes
ProcessesProcesses
Processes
 
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
 
ch3 s ppt
ch3 s                                  pptch3 s                                  ppt
ch3 s ppt
 

Recently uploaded

CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
Patterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxPatterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxMYDA ANGELICA SUAN
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptxmary850239
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.EnglishCEIPdeSigeiro
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 

Recently uploaded (20)

CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
Patterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxPatterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptx
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx
3.19.24 Urban Uprisings and the Chicago Freedom Movement.pptx
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 

OperatingSystem02..(B.SC Part 2)

  • 1. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 1 Chapter 2: Processes Process Concept Process States Process Control Block(PCB) Process Scheduling Operations on Processes Cooperating Processes Inter process Communication
  • 2. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 2 Process Concept An operating system executes a variety of programs:  Batch system – jobs  Time-shared systems – user programs or tasks The terms job and process are almost interchangeable. Process – a program in execution or manipulation A process has the attributes(properties) of  program counter Is used to keep track of the address 0f the next instruction to be executed.  Stack: Is used to store temporary data for the process.
  • 3. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 3 Five State Process Model As a process executes, it changes state  new: The process is being created.  ready: The process is waiting to be assigned to a process.  running: Instructions are being executed.  waiting: The process is waiting for some event to occur.  terminated: The process has finished execution.
  • 5. State Transition in Process New to Ready: Admitted to Ready queue, can be considered by CPU scheduler Ready to Running: To be executed next for processing Running to Ready: Process has used its current time slice Running to Blocked: Process is waiting for some event to occur.e.g I/O operation to complete. Blocked to Ready: Whatever event the process was waiting has occurred. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 5
  • 6. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 6 Process Control Block (PCB) It is a data structure that contains all the information for a process to be used for controlling its execution and the resources used for that process. Every process has its own PCB. Information associated with each process. Process state (Ready, running, wait) Program counter (Points to the next instruction to be executed) CPU registers(Data is stored in registers after Interrupt occurs )
  • 7. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 7 •CPU scheduling information: It holds the information such as process priority. •Memory-management information (information such as base register, page table etc) •Accounting information: ( Holds the amount of CPU time, process to date, or process number) •I/O status information: (Holds the list of I/O devices)
  • 8. Process Scheduling Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 8 Technique used where there are limited resources and many processes competing for them. This is needed when there are more processes and one processor. In this way some processes will have to wait until CPU becomes available. If there are more processes then the operating system must schedule the process. Many techniques are used for this purpose.
  • 9. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 9 Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device.
  • 10. Process migration between various queues The process of moving between various queues is known as Process migration. i.e moving between ready, waiting and possibly job queues and finally job finishes the task. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 10
  • 11. CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them.  Non-preemptive Scheduling  Once CPU has been allocated to a process, the process keeps the CPU until  Process exits  Preemptive Scheduling  Process can be interrupted and must release the CPU after time slice terminates.
  • 12. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 12 Schedulers Long-term scheduler (or job scheduler) – selects which processes should be brought from job queue into the ready queue. Processes are added to the system much less frequently then processes are swapped between the ready queue and CPU.The long term scheduler controls the degree of multiprogramming. Long term scheduler should select a good process mix of processes to better the system performance. It is also called as job scheduling.
  • 14. SHORT-TERM SCHEDULER: (or CPU scheduler) – selects which process should be executed next and allocates CPU. It selects a process from ready queue and gives the control of CPU to that process. Processes gets the CPU for a short time slice while the short time scheduler decides that which job well run next. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 14
  • 15. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 15 Medium Term Scheduling Time sharing OSs may introduce a medium term scheduler Removes processes from memory to reduce the degree of multiprogramming It swaps the process between memory and secondary storage. It improves the system by reducing the degree of multiprogramming. I/O-bound process – spends more time doing I/O than computations. CPU-bound process – spends more time doing computations.
  • 16. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 16 Context Switch When the CPU switches to another process, an interrupt occurs. The system must save the state of the old process and load the saved state for the new process. Context-switch time is overhead; the system does no useful work while switching.
  • 17. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 17 Process Creation Parent process create children processes which, in turn, create other processes forming a tree of processes. Each process is assigned a unique process identifier (pid) Resource sharing  Parent and children share all resources.  Children share subset of parent’s resources. Execution  Parent and children execute concurrently.  Parent waits until some or all of its children terminate.
  • 18. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 18 Process Termination Process executes last statement and asks the operating system to delete it by using the exit  Time Slot finished  Process’ resources are deal located by operating system. Parent may terminate execution of children processes  Child has exceeded allocated resources.  Task assigned to child is no longer required.  Parent is exiting.  Some operating systems do not allow child to continue if its parent terminates
  • 19. Inter Process Communication An IPC is used to provide two operations of sending and receiving message. If two process wish two communicate with each other.  Establish a communication link between them.  Exchange messages using the send and receive operations.  To synchronize there actions Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 19
  • 20. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 20 Direct Communication Processes must name each other explicitly (a disadvantage):  send (P, message) – send a message to process P  receive(Q, message) – receive a message from process Q Properties of communication link  Links are established automatically.  A link is associated with exactly one pair of communicating processes.  Between each pair there exists exactly one link.  The link may be unidirectional, but is usually bi-directional.  the print server.
  • 21. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 21 Indirect Communication Messages are directed and received from mailboxes (also referred to as ports).  Each mailbox has a unique id.  Processes can communicate only if they share a mailbox. Properties of communication link  Link established only if processes share a common mailbox  A link may be associated with many processes.  Each pair of processes may share several communication links.  Link may be unidirectional or bi-directional.
  • 22. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 22 Buffering(RAM) Whether the communication link is direct or indirect, messages exchanged by communicating processes resides in a temporary queue. e.g Copy, Paste Bounded capacity Unbounded capacity
  • 23. Silberschatz / OS Concepts / 6e - Chapter 4 Processes Slide 23