0% found this document useful (0 votes)
24 views6 pages

Process Synchronization

The document discusses process synchronization and solutions to the critical section problem. It defines a critical section as a code segment where shared data is accessed. It also describes three requirements for solving the critical section problem: mutual exclusion, progress, and bounded waiting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views6 pages

Process Synchronization

The document discusses process synchronization and solutions to the critical section problem. It defines a critical section as a code segment where shared data is accessed. It also describes three requirements for solving the critical section problem: mutual exclusion, progress, and bounded waiting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Process Synchronization

Nadishani N. Gunasekara
[Link] Computer Science(University of Colombo)
[Link] Special Hons in IT (SLIIT)

1
Process Synchronization

• A cooperating process can affect or be affected by the


other processes executing in the system.
– an independent process cannot affect or be affected by other
processes.
• Cooperating processes may:
– Share a logical address space (i.e., both code and data)
– Share data through files
• Concurrent access to shared data may result in data
inconsistency.
• Maintaining data consistency requires mechanisms to
ensure the orderly execution of cooperating processes.
2
Process Synchronization contd..

• Race condition is a situation where several processes


access and manipulate the same data concurrently.
– the outcome of the execution depends on particular order in
which the access takes place.
• In order to prevent race condition on counter (in case 1),
we need to ensure that only one process at a time can be
manipulating counter
– We need some form of process synchronization.

3
The Critical Section Problem
• n processes {P0, P1, …, Pn-1} all competing to use some shared
data.
• Each process has a code segment, called critical section, in which
the shared data is accessed.
• The problem is to make sure that when one process is executing in
its critical section, no other process is allowed to execute in its
critical section.

Structure of process Pi
Repeat
Entry section.
Critical section.
Exit section.
Remainder section.
Until false; 4
Solutions to Critical Section Problem
Must Satisfy these requirements:
1. Mutual Exclusion
If a process is in the critical section then no other processes can be
executing in their critical sections
– or No processes may be simultaneously inside their critical sections.

2. Progress
If no process is in its critical section and there exists some
processes that wish to enter their critical sections, then only
processes not in their remainder section can participate in the
decision as to which one enters its critical section next (cannot
postpone indefinitely)
– or No process running outside its critical section may block other processes from
entering their critical sections.
5
Solutions to Critical Section Problem

3. Bounded Waiting
There must exist a bound on the number of times that other
processes can enter their critical section after a process has made a
request to enter its critical section and before that request is
granted;
– or No process should have to wait forever to enter its critical section.

You might also like