DIZNR INTERNATIONAL

CSEIT – GATE 2025 Subject – Operating System/Topic – Process Synchronization (based on Algo-3).

CSEIT – GATE 2025 Subject – Operating System/Topic – Process Synchronization (based on Algo-3).

https://www.gyanodhan.com/video/7B7.%20GATE%20CSEIT/Operating%20System/631.%20CSEIT%20-%20GATE%202001%20%20%20Subject%20-%20Operating%20System%20%20%20Topic%20-%20Process%20Synchronization%20%28based%20on%20Algo-3%29.mp4

Here is a structured and GATE-focused explanation for:


CSE/IT – GATE 2025

Subject: Operating System

Topic: Process Synchronization (Based on Algo-3 – Peterson’s Algorithm)


What is Process Synchronization?

Process Synchronization is the technique used to coordinate the execution of concurrent processes that share resources. It ensures that:


Algo-3: Peterson’s Algorithm

Used for: Synchronization between 2 processes (P0 and P1)
Type: Software-based solution
Key Features:


Shared Variables:

c
boolean flag[2] = {false, false}; // Indicates interest in entering CS
int turn = 0; // Whose turn is it?

Code for Process Pi (i = 0 or 1):

c
// Entry Section
flag[i] = true; // Express interest in entering CS
turn = 1 - i; // Give turn to the other process
while (flag[1 - i] && turn == 1 - i)
; // Busy wait

// ---- Critical Section ----

// Exit Section
flag[i] = false; // Exit CS


How It Works:


Satisfies the 3 Conditions of Critical Section Problem:

Condition Met? Explanation
Mutual Exclusion Only one process can enter the CS at a time.
Progress A process not in CS doesn’t block others.
Bounded Waiting Each process gets a turn in a finite time.

GATE-Style Example Question:

Q: In Peterson’s algorithm for two processes P0 and P1, what ensures mutual exclusion?

A. Setting turn = 1 - i
B. The flag array
C. The combination of flag[] and turn
D. None of the above

Correct Answer: C – Both flag[] and turn are essential for mutual exclusion.


Summary:


Would you like:

Let me know how you’d like to prepare!

CSEIT – GATE 2025 Subject – Operating System/Topic – Process Synchronization (based on Algo-3).

OPERATING SYSTEMS PROCESS SYNCHRONIZATION

Computer Science & Engineering Second Year