How is "bounded waiting" achieved in here?

  • Context: Comp Sci 
  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Synchronization
Click For Summary

Discussion Overview

The discussion centers around the concept of "bounded waiting" in the context of mutual exclusion algorithms, particularly in relation to a code snippet provided by a participant. The scope includes theoretical aspects of operating systems and algorithm design.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses understanding of mutual exclusion but seeks clarification on how bounded waiting is achieved in the provided code snippet.
  • Another participant suggests reviewing Peterson's algorithm as a relevant resource for understanding bounded waiting.
  • A third participant provides a link to a presentation on operating systems, indicating a desire to discuss proving mutual exclusion.
  • A later reply questions whether the initial poster now understands bounded waiting after asking about proving mutual exclusion, implying a connection between the two concepts.
  • One participant emphasizes focusing on the bounded waiting question and offers an alternative code snippet, stating that bounded waiting ensures no process is starved of resource access.
  • The analogy of a gun range is introduced to illustrate bounded waiting, where a range master ensures each person (process) gets a chance to use the shared resource (gun range).

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the understanding of bounded waiting, as there are differing interpretations and examples provided. The discussion remains unresolved regarding the clarity of the initial code snippet and its implications for bounded waiting.

Contextual Notes

There are indications that the initial code snippet may contain errors, and participants express varying levels of understanding regarding the formal proofs of mutual exclusion and bounded waiting.

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   Reactions: 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