Comp Sci How is "bounded waiting" achieved in here?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Synchronization
Click For Summary
SUMMARY

This discussion focuses on the concept of "bounded waiting" in the context of mutual exclusion, specifically referencing Peterson's algorithm. Bounded waiting ensures that no process is indefinitely delayed from accessing a shared resource, akin to a range master allowing each shooter a turn. The provided code snippets illustrate the mechanism of setting the turn variable to manage access among multiple processes. The conversation also highlights the importance of accurate code representation for understanding these concepts.

PREREQUISITES
  • Understanding of mutual exclusion in concurrent programming
  • Familiarity with Peterson's algorithm
  • Basic knowledge of process synchronization
  • Ability to interpret pseudocode and algorithmic structures
NEXT STEPS
  • Study the implementation details of Peterson's algorithm in various programming languages
  • Learn about other algorithms that achieve bounded waiting, such as Lamport's bakery algorithm
  • Explore formal methods for proving mutual exclusion and bounded waiting
  • Investigate real-world applications of process synchronization in operating systems
USEFUL FOR

Computer science students, software engineers, and anyone involved in concurrent programming or operating system design will benefit from this discussion.

shivajikobardan
Messages
637
Reaction score
54
Homework Statement
How's bounded waiting achieved in here?
Relevant Equations
How's bounded waiting achieved in here?
Physics news on Phys.org
You first ask about understanding bounded waiting and now you ask how to prove mutual exclusion. Does this mean you now understand why bounded waiting is obtained?

Proving stuff (depending on the formal framework you use) can be much more difficult and nitpicking than understanding, rather similar to math stuff. And, by the way, your code snippet is messed up, so please refer to the snippet in the wiki link I gave or something similar valid.
 
  • Haha
Likes shivajikobardan
In the interests of sanity, let's try to answer the bounded waiting question only.

Your example is not quite correct, here is a better one although it too is not the way it would really be done.

[CODE lang="python" title="Mutex"]

P_i:
do {
while(turn!=i);

## start of critical section

turn=(i+1) mod n;

## where i is the proc-id and n is the # of processes wanting the resource

## do your critical code here

## end of critical section

## remainder section

} while(1);
[/CODE]

Bounded waiting means no consumer of a resource will be starved out of using shared resources by other consumers.

It’s like folks at a gun range where they all want to shoot but the range master designates who can make the next shot and ensures that each person gets a chance to shoot.

The people are the processes waiting on the resource, the range master is the algorithm that handles bounded waiting and the gun range is the shared resource.
 
Last edited:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
Replies
27
Views
7K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 75 ·
3
Replies
75
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K