Process Synchronization in Operating Systems: Definition & Mechanisms Video

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: Process Cooperation in Operating Systems: Definition & Examples

You're on a roll. Keep up the good work!

Take Quiz Watch Next Lesson
Your next lesson will play in 10 seconds
  • 0:04 Process Synchronization
  • 0:46 Critical Section
  • 1:21 Semaphores
  • 2:43 Lesson Summary
Save Save Save

Want to watch this again later?

Log in or sign up to add this lesson to a Custom Course.

Log in or Sign up

Speed Speed

Recommended Lessons and Courses for You

Lesson Transcript
Instructor: Meghalee Goswami
This lesson describes process synchronization and explains how it is managed by the operating system. It also explains the synchronization mechanisms, such as wait() and signal(), as well as semaphores and race conditions.

Process Synchronization

Process Synchronization is a way to coordinate processes that use shared data. It occurs in an operating system among cooperating processes. Cooperating processes are processes that share resources. While executing many concurrent processes, process synchronization helps to maintain shared data consistency and cooperating process execution. Processes have to be scheduled to ensure that concurrent access to shared data does not create inconsistencies. Data inconsistency can result in what is called a race condition. A race condition occurs when two or more operations are executed at the same time, not scheduled in the proper sequence, and not exited in the critical section correctly.

Critical Section

A critical section is a segment of code that can be accessed by only one signal process at a certain instance in time. This section consists of shared data resources that need to be accessed by other processes. The entry to the critical section is handled by the wait() function, represented as P(). The exit from a critical section is controlled by the signal() function, represented as V(). Only one process can be executed inside the critical section at a time. Other processes waiting to execute their critical sections have to wait until the current process finishes executing its critical section.


A critical section execution is handled by a semaphore. A semaphore is simply a variable that stores an integer value. This integer can be accessed by two operations: wait() and signal(). When a process enters the critical section, P(s) is invoked and the semaphore s is set to 1. After the process exits the critical section, s is re-initialized to 0. An example of how Process P is executed inside the critical section is shown below:

//Some Code


//critical section(cs)

//exit from cs


//remaining code

Semaphores can be classified into two types:

  • Binary semaphore
  • Counting semaphore

A binary semaphore can only take two values: 0 and 1. These semaphores are also known as mutex locks and are used to ensure mutual exclusion. If the mutex semaphore s is initialized to 0, then other processes can access the critical section. Otherwise, they have to wait for the process inside the critical section (where s=1) to finish its execution and s is set to 0.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account