Processes and Threads Chapter 2 2.1 Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling
Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential processes Only one program active at any instant
Process Creation Principal events that cause process creation System initialization Execution of a process creation system  User request to create a new process Initiation of a batch job
Process Termination Conditions which terminate processes Normal exit (voluntary) Error exit (voluntary) Fatal error (involuntary) Killed by another process (involuntary)
Process Hierarchies Parent creates a child process, child processes can create its own process Forms a hierarchy UNIX calls this a "process group" Windows has no concept of process hierarchy all processes are created equal
Process States (1) Possible process states running blocked ready Transitions between states shown
Process States (2) Lowest layer of process-structured OS handles interrupts, scheduling Above that layer are sequential processes
Implementation of Processes (1) Fields of a process table entry
Implementation of Processes (2) Skeleton of what lowest level of OS does when an interrupt occurs
Threads The Thread Model (1) (a) Three processes each with one thread (b) One process with three threads
The Thread Model (2) Items shared by all threads in a process Items private to each thread
The Thread Model (3) Each thread has its own stack
Thread Usage (1) A word processor with three threads
Thread Usage (2) A multithreaded Web server
Thread Usage (3) Rough outline of code for previous slide (a) Dispatcher thread (b) Worker thread
Thread Usage (4) Three ways to construct a server
Implementing Threads in User Space A user-level threads package
Implementing Threads in the Kernel A threads package managed by the kernel
Hybrid Implementations Multiplexing user-level threads onto kernel- level threads
Scheduler Activations Goal – mimic functionality of kernel threads gain performance of user space threads Avoids unnecessary user/kernel transitions Kernel assigns virtual processors to each process lets runtime system allocate threads to processors Problem:   Fundamental reliance on kernel (lower layer)  calling procedures in user space (higher layer)
Pop-Up Threads Creation of a new thread when message arrives (a) before message arrives (b) after message arrives
Making Single-Threaded Code Multithreaded (1) Conflicts between threads over the use of a global variable
Making Single-Threaded Code Multithreaded (2) Threads can have private global variables
Interprocess Communication Race Conditions Two processes want to access shared memory at same time
Critical Regions (1) Four conditions to provide mutual exclusion No two processes simultaneously in critical region No assumptions made about speeds or numbers of CPUs No process running outside its critical region may block another process No process must wait forever to enter its critical region
Critical Regions (2) Mutual exclusion using critical regions
Mutual Exclusion with Busy Waiting (1) Proposed solution to critical region problem (a) Process 0.  (b) Process 1.
Mutual Exclusion with Busy Waiting (2) Peterson's solution for achieving mutual exclusion
Mutual Exclusion with Busy Waiting (3) Entering and leaving a critical region using the  TSL  instruction
Sleep and Wakeup Producer-consumer problem with fatal race condition
Semaphores The producer-consumer problem using semaphores
Mutexes Implementation of  mutex_lock  and  mutex_unlock
Monitors (1) Example of a monitor
Monitors (2) Outline of producer-consumer problem with monitors only one monitor procedure active at one time buffer has  N  slots
Monitors (3) Solution to producer-consumer problem in Java (part 1)
Monitors (4) Solution to producer-consumer problem in Java (part 2)
Message Passing The producer-consumer problem with N messages
Barriers Use of a barrier processes approaching a barrier all processes but one blocked at barrier last process arrives, all are let through
Dining Philosophers (1) Philosophers eat/think Eating needs 2 forks Pick one fork at a time  How to prevent deadlock
Dining Philosophers (2) A  non solution to the dining philosophers problem
Dining Philosophers (3) Solution to dining philosophers problem (part 1)
Dining Philosophers (4) Solution to dining philosophers problem (part 2)
The Readers and Writers Problem A solution to the readers and writers problem
The Sleeping Barber Problem (1)
The Sleeping Barber Problem (2) Solution to sleeping barber problem.
Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait a CPU-bound process an I/O bound process
Introduction to Scheduling (2) Scheduling Algorithm Goals
Scheduling in Batch Systems (1) An example of shortest job first scheduling
Scheduling in Batch Systems (2) Three level scheduling
Scheduling in Interactive Systems (1) Round Robin Scheduling list of runnable processes list of runnable processes after B uses up its quantum
Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes
Scheduling in Real-Time Systems Schedulable real-time system Given m  periodic events event  i  occurs within period P i  and requires C i  seconds Then the load can only be handled if
Policy versus Mechanism Separate what is  allowed  to be done with  how  it is done a process knows which of its children threads are important and need priority Scheduling algorithm parameterized mechanism in the kernel Parameters filled in by user processes policy set by user process
Thread Scheduling (1) Possible scheduling of user-level threads 50-msec process quantum threads run 5 msec/CPU burst
Thread Scheduling (2) Possible scheduling of kernel-level threads 50-msec process quantum threads run 5 msec/CPU burst

More Related Content

PDF
Kcd226 Sistem Operasi Lecture04
PPT
Chapter 02
PPT
Processes and Thread OS_Tanenbaum_3e
PPT
Real-Time Scheduling Algorithms
PPT
The Windows Scheduler
PPTX
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
PPTX
Windows process-scheduling
Kcd226 Sistem Operasi Lecture04
Chapter 02
Processes and Thread OS_Tanenbaum_3e
Real-Time Scheduling Algorithms
The Windows Scheduler
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
Windows process-scheduling

What's hot (20)

PDF
Real Time Operating System Concepts
PDF
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
PDF
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
PPTX
Windows process scheduling presentation
PDF
Os Question Bank
PPT
Real time-embedded-system-lec-02
PDF
3 process management
PPT
Rtos Concepts
PPTX
Lecture 5 process concept
PDF
Rtos part2
PPT
process management
PPTX
Operating system - Process and its concepts
PDF
Real Time Operating Systems
PDF
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
PPTX
Real Time Kernels
PPT
OS Process and Thread Concepts
DOC
Introduction to Operating System (Important Notes)
PPT
Chapter 19 - Real Time Systems
PDF
Tutotial 2 answer
Real Time Operating System Concepts
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
Windows process scheduling presentation
Os Question Bank
Real time-embedded-system-lec-02
3 process management
Rtos Concepts
Lecture 5 process concept
Rtos part2
process management
Operating system - Process and its concepts
Real Time Operating Systems
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Real Time Kernels
OS Process and Thread Concepts
Introduction to Operating System (Important Notes)
Chapter 19 - Real Time Systems
Tutotial 2 answer
Ad

Similar to Chapter 02 (20)

PPT
OPERATING SYSTEM CHAPTER 3.ppt
PPT
procress and threads.ppt
PPT
Process and Thread
PPT
Processes and Threads in modern Operating system
PDF
Unit 2 part 2(Process)
PPT
Processes, Threads and Scheduler
DOC
Wiki 2
PPT
Ipc ppt
PPT
chapter4-processes nd processors in DS.ppt
PPT
MODERN OPERATING SYSTEMS Chapter02 Processes and Threads.ppt
PPT
OS Process Synchronization, semaphore and Monitors
PPT
Process management
PPTX
Lecture 5 inter process communication
PPT
Chapter 02 modified
ODP
Multithreading 101
PPTX
Concurrency: Mutual Exclusion and Synchronization
PDF
Lect07
OPERATING SYSTEM CHAPTER 3.ppt
procress and threads.ppt
Process and Thread
Processes and Threads in modern Operating system
Unit 2 part 2(Process)
Processes, Threads and Scheduler
Wiki 2
Ipc ppt
chapter4-processes nd processors in DS.ppt
MODERN OPERATING SYSTEMS Chapter02 Processes and Threads.ppt
OS Process Synchronization, semaphore and Monitors
Process management
Lecture 5 inter process communication
Chapter 02 modified
Multithreading 101
Concurrency: Mutual Exclusion and Synchronization
Lect07
Ad

More from Geonyzl Alviola (20)

ODP
Ginkgo biloba
PPT
family Equisetaceae
PPTX
Ginkgonrew
PPT
Biogerographyand ecology of ferns
PPT
Body design
PDF
Chapter1part2
PPT
Lifehistoryandembryogenesis(revised)
PPTX
Bio 211 report
PPT
Vertebrate ch1
PPT
Chapter 1(part2) by kardong
PPT
Nonvascularplants
PPT
PPT
PDF
Flower Morphology 2 (updated)
PDF
Flowers 100131104452-phpapp01
PPTX
Micro filaments
PPTX
Cytoskeleton
PPT
Chapter 8 by Karp (part2)
PPTX
Cytoplasmic membrane systems (chap8)
PPT
Interactions Between Cells and Their Environment
Ginkgo biloba
family Equisetaceae
Ginkgonrew
Biogerographyand ecology of ferns
Body design
Chapter1part2
Lifehistoryandembryogenesis(revised)
Bio 211 report
Vertebrate ch1
Chapter 1(part2) by kardong
Nonvascularplants
Flower Morphology 2 (updated)
Flowers 100131104452-phpapp01
Micro filaments
Cytoskeleton
Chapter 8 by Karp (part2)
Cytoplasmic membrane systems (chap8)
Interactions Between Cells and Their Environment

Recently uploaded (20)

PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
Hazard Identification & Risk Assessment .pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
HVAC Specification 2024 according to central public works department
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
History, Philosophy and sociology of education (1).pptx
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Hazard Identification & Risk Assessment .pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
TNA_Presentation-1-Final(SAVE)) (1).pptx
HVAC Specification 2024 according to central public works department
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Share_Module_2_Power_conflict_and_negotiation.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Introduction to pro and eukaryotes and differences.pptx
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
202450812 BayCHI UCSC-SV 20250812 v17.pptx
History, Philosophy and sociology of education (1).pptx
A powerpoint presentation on the Revised K-10 Science Shaping Paper
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)

Chapter 02