You are on page 1of 4

GeeksforGeeks

A computer science portal for geeks

Custom Search
search
Practice GATE CS Placements Videos Contribute

Login/Register
Skip to content
Algo DS Languages Interview Students GATE CS Subjects
Quizzes GBlog Puzzles Whats New?
Quick Links for Operating Systems
Recent Articles
MCQ / Quizzes
Practice Problems
Last Minute Notes (LMNs)

Basics
What happens when we turn on computer?
Explore More...
Processes & Threads
Process - Introduction
Thread
User Level thread vs. Kernel Level thread
Zombie Processes and their Prevention
Maximum number of Zombie process a system can handle
Maximum number of threads that can be created within a process in C
What exactly Spooling is all about?
Multi threading models
Explore More...
Process Synchronization
Introduction & Critical Section
Inter Process Communication
Mutex vs Semaphore & Monitors
Petersons Algorithm for Mutual Exclusion | Set 1 & Set 2
Readers-Writers Problem
Priority Inversion : What the heck !
Bankers Algorithm & Program
Priority Inversion vs. Priority Inheritance
Explore More...
CPU Scheduling
Process Management - Introduction
CPU Scheduling & Process Scheduler
FCFS Scheduling | Set 1 & Set 2
SJF scheduling
Round Robin scheduling
Priority Scheduling
Explore More...
Deadlocks
Introduction
Detection And Recovery
Prevention And Avoidance
Explore More...
Memory Management
Partition Allocation Method
Virtual Memory
Paging
Segmentation
Page Replacement Algorithms
Static and Dynamic Libraries
Working with Shared Libraries | Set 1 & Set 2
Explore More...
File & Disk Management
File System
File Allocation Methods
Disk Scheduling Algorithms
Explore More...
Linux
Linux File Hierarchy Structure
Initializing and Cache Mechanism in Linux Kernel
Some useful Linux Hacks
Explore More...
Process Synchronization | Monitors
Monitor is one of the ways to achieve Process synchronization. Monitor is supported
by programming languages to achieve mutual exclusion between processes. For example
Java Synchronized methods. Java provides wait() and notify() constructs.

1. It is the collection of condition variables and procedures combined together in


a special kind of module or a package.
2. The processes running outside the monitor cant access the internal variable of
monitor but can call procedures of the monitor.
3. Only one process at a time can execute code inside monitors.

Syntax of Monitor

monitors

Condition Variables

Two different operations are performed on the condition variables of the monitor.

Wait.
signal.
let say we have 2 condition variables
condition x, y; //Declaring variable

Wait operation
x.wait() : Process performing wait operation on any condition variable are
suspended. The suspended processes are placed in block queue of that condition
variable.

Note: Each condition variable has its unique block queue.

Signal operation
x.signal(): When a process performs signal operation on condition variable, one of
the blocked processes is given chance.

If (x block queue empty)


// Ignore signal
else
// Resume a process from block queue.
Please write comments if you find anything incorrect, or you want to share more
information about the topic discussed above
GATE CS Corner Company Wise Coding Practice

Operating Systems Process Synchronization


Recommended Posts:

Readers-Writers Problem | Set 1 (Introduction and Readers Preference Solution)


Operating System | Process Synchronization | Introduction
Operating System | User Level thread Vs Kernel Level thread
What exactly Spooling is all about?
Operating System | Bankers Algorithm

Post navigation<< Previous PostNext Post >>


(Login to Rate and Mark)

0 Average Difficulty : 0/5.0


No votes yet.

Add to TODO List


Mark as DONE

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share
the link here.

Load Comments
Share this post!

Trending Content
Pairwise swap elements of a given linked list
Longest Consecutive Subsequence
C-Advanced Pointer
GATE | GATE 2017 MOCK II | Question 38
Data Structures | Queue | Question 11
Pattern Searching | Set 7 (Boyer Moore Algorithm ? Bad Character Heuristic)
The Celebrity Problem
Sorted Linked List to Balanced BST
Count distinct elements in every window of size k
Myntra Interview Experience | Set 5
ProGeek Cup 1.0

Most Visited Posts


Top 10 Algorithms and Data Structures for Competitive Programming
Top 10 algorithms in Interview Questions
How to begin with Competitive Programming?
Step by Step Guide for Placement Preparation
How to prepare for ACM-ICPC?
Insertion Sort, Binary Search, QuickSort, MergeSort, HeapSort
ads by BSA
Popular Categories
Interview Experiences
Advanced Data Structures
Dynamic Programming
Greedy Algorithms
Backtracking
Pattern Searching
Divide & Conquer
Geometric Algorithms
Searching
Sorting
Analysis of Algorithms
Mathematical Algorithms
Randomized Algorithms
Recursion
Game Theory
Tags
Advanced Data Structure Amazon Aptitude Aptitude Arrays Bit Magic C C C++ C++ Quiz
CPP-Library C Quiz Data Structures Data Structures DBMS Dynamic Programming
Experienced GATE-CS-2012 GBlog Graph Hash Internship Interview Experiences Java
java- Java Quiz Linked Lists Mathematical Matrix MCQ Microsoft number-digits
Program Output Project Puzzles Python QA - Placement Quizzes QA - Placement Quizzes
School Programming Searching Sorting STL Strings Technical Scripter Trees
Advertise Here
Recent Comments
@geeksforgeeks, Some rights reserved Contact Us! About Us!
Advertise with us! Privacy Policy

You might also like