SlideShare a Scribd company logo
1 of 20
PROCESS SYNCHRONIZATION SONALI C. UDIT-SYBSc-IT 2008-09
INTRODUCTION ,[object Object],[object Object],[object Object]
CRITICAL SECTION ,[object Object],[object Object],[object Object],[object Object]
CRITICAL SECTION ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Cont… Entry section exit section GENERAL STRUCTURE  OF A TYPICAL PROCESS Pi
CRITICAL SECTION ,[object Object],[object Object],[object Object],[object Object],Cont…
TWO-PROCESS SOLUTION ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TWO-PROCESS SOLUTION -Algorithm 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Do{   Critical section remainder section }while(1) For Process P i while (turn != i); Turn = j;
TWO-PROCESS SOLUTION -Algorithm 2 ,[object Object],[object Object],[object Object],[object Object],do {   flag[i] = true;   // declare your own interest     while (flag[ j]) ;   //wait if the other guy is interested     critical section   flag [i] = false;   // declare that you lost interest   remainder section  // allows other guy to enter } while (1);
[object Object],[object Object],[object Object],[object Object],TWO-PROCESS SOLUTION -Algorithm 2
[object Object],TWO-PROCESS SOLUTION -Algorithm 3 For Process P i do  { flag [i] = true;  // declare your interest to enter turn = j;  // assume it is the other’s turn-give PJ a chance while (flag [ j ] and turn == j) ; critical section flag [i] = false; remainder section }  while (1);
[object Object],[object Object],[object Object],TWO-PROCESS SOLUTION -Algorithm 3
MULTIPLE-PROCESS SOLUTIONS - Bakery Algorithm ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],MULTIPLE-PROCESS SOLUTIONS - Bakery Algorithm
[object Object],MULTIPLE-PROCESS SOLUTIONS - Bakery Algorithm
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],do {   /* Has four states: choosing, scanning, CS, remainder section */ critical section /* no longer a candidate for CS entry */ remainder section } while (1); number[i] = 0;
SEMAPHORSES ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SEMAPHORSES ,[object Object],Definition-Wait wait(S) { while(S<=0) ; //no-op S--; } Definition-signal Signal(S) { S++; }
[object Object],struct  semaphore { int  count; queueType  queue; } void wait(semaphore s) { s.count--; if  (s.count < 0) { place this process in s.queue; block this process } } void signal(semaphore s) { s.count++; if  (s.count <= 0) { remove a process P from s.queue; place process P on ready list; } }
SEMAPHORES -Two Type  ,[object Object],[object Object],[object Object]
SEMAPHORES -Binary Semaphores ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Process synchronization(deepa)
Process synchronization(deepa)Process synchronization(deepa)
Process synchronization(deepa)
Nagarajan
 

What's hot (20)

Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
Operating System Process Synchronization
Operating System Process SynchronizationOperating System Process Synchronization
Operating System Process Synchronization
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
Ch1-Operating System Concepts
Ch1-Operating System ConceptsCh1-Operating System Concepts
Ch1-Operating System Concepts
 
Operating system 18 process creation and termination
Operating system 18 process creation and terminationOperating system 18 process creation and termination
Operating system 18 process creation and termination
 
5 process synchronization
5 process synchronization5 process synchronization
5 process synchronization
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Concurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and SynchronizationConcurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and Synchronization
 
Memory management
Memory managementMemory management
Memory management
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Process synchronization(deepa)
Process synchronization(deepa)Process synchronization(deepa)
Process synchronization(deepa)
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's types
 
Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution
 

Viewers also liked

Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
Wayne Jones Jnr
 
Lec11 semaphores
Lec11 semaphoresLec11 semaphores
Lec11 semaphores
anandammca
 

Viewers also liked (20)

Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
 
OS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and MonitorsOS Process Synchronization, semaphore and Monitors
OS Process Synchronization, semaphore and Monitors
 
Operating Systems - Synchronization
Operating Systems - SynchronizationOperating Systems - Synchronization
Operating Systems - Synchronization
 
Semaphores
SemaphoresSemaphores
Semaphores
 
Ch7: Process Synchronization
Ch7: Process SynchronizationCh7: Process Synchronization
Ch7: Process Synchronization
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Semaphores OS Basics
Semaphores OS BasicsSemaphores OS Basics
Semaphores OS Basics
 
Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and Deadlocks
 
Lec11 semaphores
Lec11 semaphoresLec11 semaphores
Lec11 semaphores
 
06 lcd slides 1 - PROCESS SYNCHRONIZATION POWERPOINT
06 lcd slides 1 - PROCESS SYNCHRONIZATION POWERPOINT06 lcd slides 1 - PROCESS SYNCHRONIZATION POWERPOINT
06 lcd slides 1 - PROCESS SYNCHRONIZATION POWERPOINT
 
System software
System softwareSystem software
System software
 
Producer consumer
Producer consumerProducer consumer
Producer consumer
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Process synchronization in multi core systems using on-chip memories
Process synchronization in multi core systems using on-chip memoriesProcess synchronization in multi core systems using on-chip memories
Process synchronization in multi core systems using on-chip memories
 
Process Synchronization-R.D.Sivakumar
Process Synchronization-R.D.SivakumarProcess Synchronization-R.D.Sivakumar
Process Synchronization-R.D.Sivakumar
 
Shared memory and semaphore? And how to use them? An explanation about those ...
Shared memory and semaphore? And how to use them? An explanation about those ...Shared memory and semaphore? And how to use them? An explanation about those ...
Shared memory and semaphore? And how to use them? An explanation about those ...
 

Similar to Process Synchronization

Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OS
C.U
 

Similar to Process Synchronization (20)

OSCh7
OSCh7OSCh7
OSCh7
 
OS_Ch7
OS_Ch7OS_Ch7
OS_Ch7
 
CH05.pdf
CH05.pdfCH05.pdf
CH05.pdf
 
Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's Algorithm
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OS
 
OS Process synchronization Unit3 synchronization
OS Process synchronization Unit3  synchronizationOS Process synchronization Unit3  synchronization
OS Process synchronization Unit3 synchronization
 
Operating System
Operating SystemOperating System
Operating System
 
Operatioooooooooooooooooooooooooooooooooooooooooooooo
OperatiooooooooooooooooooooooooooooooooooooooooooooooOperatioooooooooooooooooooooooooooooooooooooooooooooo
Operatioooooooooooooooooooooooooooooooooooooooooooooo
 
Ch6
Ch6Ch6
Ch6
 
14- Process Synchronization.pptx
14- Process Synchronization.pptx14- Process Synchronization.pptx
14- Process Synchronization.pptx
 
Os3
Os3Os3
Os3
 
Lecture16-17.ppt
Lecture16-17.pptLecture16-17.ppt
Lecture16-17.ppt
 
15- Bakery-Algorithm.pptx
15- Bakery-Algorithm.pptx15- Bakery-Algorithm.pptx
15- Bakery-Algorithm.pptx
 
Critical Section Problem - Ramakrishna Reddy Bijjam
Critical Section Problem - Ramakrishna Reddy BijjamCritical Section Problem - Ramakrishna Reddy Bijjam
Critical Section Problem - Ramakrishna Reddy Bijjam
 
6 Synchronisation
6 Synchronisation6 Synchronisation
6 Synchronisation
 
Ch7
Ch7Ch7
Ch7
 
U3-PPT-1 (1).ppt
U3-PPT-1 (1).pptU3-PPT-1 (1).ppt
U3-PPT-1 (1).ppt
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communication
 
Operating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphoresOperating system 24 mutex locks and semaphores
Operating system 24 mutex locks and semaphores
 
Lab
LabLab
Lab
 

More from Sonali Chauhan

Chapter 2 enterprise an overview - alexis leon
Chapter 2 enterprise  an overview - alexis leonChapter 2 enterprise  an overview - alexis leon
Chapter 2 enterprise an overview - alexis leon
Sonali Chauhan
 
Chapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERPChapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERP
Sonali Chauhan
 
Chapter 5 E R P Modules Alexis Leon
Chapter 5  E R P  Modules    Alexis  LeonChapter 5  E R P  Modules    Alexis  Leon
Chapter 5 E R P Modules Alexis Leon
Sonali Chauhan
 
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Chapter 7   E R P  Implementation  Lifecycle    Alexis  LeonChapter 7   E R P  Implementation  Lifecycle    Alexis  Leon
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Sonali Chauhan
 
Chapter 10 Future Directions In Erp A Lexis Leon
Chapter 10 Future Directions In Erp   A Lexis LeonChapter 10 Future Directions In Erp   A Lexis Leon
Chapter 10 Future Directions In Erp A Lexis Leon
Sonali Chauhan
 
Chapter 9 Vendors Consultants Users Alexis Leon
Chapter 9  Vendors  Consultants  Users    Alexis  LeonChapter 9  Vendors  Consultants  Users    Alexis  Leon
Chapter 9 Vendors Consultants Users Alexis Leon
Sonali Chauhan
 
Chapter 1 enterprise resource planning alexis leon
Chapter 1 enterprise resource planning   alexis leonChapter 1 enterprise resource planning   alexis leon
Chapter 1 enterprise resource planning alexis leon
Sonali Chauhan
 
Chapter 2 Enterprise An Overview Alexis Leon
Chapter 2 Enterprise  An Overview   Alexis LeonChapter 2 Enterprise  An Overview   Alexis Leon
Chapter 2 Enterprise An Overview Alexis Leon
Sonali Chauhan
 
Mobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen SchillerMobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen Schiller
Sonali Chauhan
 
3.Medium Access Control
3.Medium Access Control3.Medium Access Control
3.Medium Access Control
Sonali Chauhan
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
Sonali Chauhan
 
Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10
Sonali Chauhan
 
Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5
Sonali Chauhan
 

More from Sonali Chauhan (20)

Chapter 2 enterprise an overview - alexis leon
Chapter 2 enterprise  an overview - alexis leonChapter 2 enterprise  an overview - alexis leon
Chapter 2 enterprise an overview - alexis leon
 
Chapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERPChapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERP
 
Chapter 5 E R P Modules Alexis Leon
Chapter 5  E R P  Modules    Alexis  LeonChapter 5  E R P  Modules    Alexis  Leon
Chapter 5 E R P Modules Alexis Leon
 
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Chapter 7   E R P  Implementation  Lifecycle    Alexis  LeonChapter 7   E R P  Implementation  Lifecycle    Alexis  Leon
Chapter 7 E R P Implementation Lifecycle Alexis Leon
 
Chapter 10 Future Directions In Erp A Lexis Leon
Chapter 10 Future Directions In Erp   A Lexis LeonChapter 10 Future Directions In Erp   A Lexis Leon
Chapter 10 Future Directions In Erp A Lexis Leon
 
Chapter 9 Vendors Consultants Users Alexis Leon
Chapter 9  Vendors  Consultants  Users    Alexis  LeonChapter 9  Vendors  Consultants  Users    Alexis  Leon
Chapter 9 Vendors Consultants Users Alexis Leon
 
Chapter 3 E R P And Related Tech Alexis Leon
Chapter 3  E R P And Related  Tech    Alexis  LeonChapter 3  E R P And Related  Tech    Alexis  Leon
Chapter 3 E R P And Related Tech Alexis Leon
 
Chapter 1 enterprise resource planning alexis leon
Chapter 1 enterprise resource planning   alexis leonChapter 1 enterprise resource planning   alexis leon
Chapter 1 enterprise resource planning alexis leon
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
 
Chapter 2 Enterprise An Overview Alexis Leon
Chapter 2 Enterprise  An Overview   Alexis LeonChapter 2 Enterprise  An Overview   Alexis Leon
Chapter 2 Enterprise An Overview Alexis Leon
 
Chapter 1 Enterprise Resource Planning Alexis Leon
Chapter 1 Enterprise Resource Planning   Alexis LeonChapter 1 Enterprise Resource Planning   Alexis Leon
Chapter 1 Enterprise Resource Planning Alexis Leon
 
Chapter 7 Erp Implementation Lifecycle Alexis Leon
Chapter 7  Erp Implementation Lifecycle   Alexis LeonChapter 7  Erp Implementation Lifecycle   Alexis Leon
Chapter 7 Erp Implementation Lifecycle Alexis Leon
 
Mobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen SchillerMobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen Schiller
 
Se
SeSe
Se
 
3.Medium Access Control
3.Medium Access Control3.Medium Access Control
3.Medium Access Control
 
Testing
TestingTesting
Testing
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10
 
Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Process Synchronization