How is "bounded waiting" achieved in here?

  • Comp Sci
  • Thread starter shivajikobardan
  • Start date
  • Tags
    Synchronization
In summary, bounded waiting is achieved in the given code snippet by ensuring that each process gets a turn at the shared resource before other processes can access it, preventing any one process from being starved out.
  • #1
shivajikobardan
674
54
Homework Statement
How's bounded waiting achieved in here?
Relevant Equations
How's bounded waiting achieved in here?
Physics news on Phys.org
  • #4
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
  • #5
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.

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);

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:

1. What is "bounded waiting" and why is it important?

Bounded waiting is a concept in computer science that refers to a guarantee that a process will eventually be granted access to a resource it needs. It is important because it ensures fairness and prevents a process from being starved or waiting indefinitely for a resource.

2. How is "bounded waiting" achieved in computer systems?

In computer systems, bounded waiting is typically achieved through the use of algorithms such as the "first-come, first-served" or "round-robin" scheduling algorithms. These algorithms ensure that each process is given a fair share of the resources and prevents any one process from monopolizing them.

3. What are some potential challenges in achieving "bounded waiting" in computer systems?

One potential challenge is the possibility of a process being blocked by another process that is continuously requesting resources. This can result in a process waiting for an extended period of time, violating the principle of bounded waiting. Another challenge is balancing the need for fairness with the need for efficiency in resource allocation.

4. Can "bounded waiting" be achieved in real-time systems?

Yes, "bounded waiting" can be achieved in real-time systems by using priority-based scheduling algorithms. These algorithms prioritize processes based on their importance and urgency, ensuring that critical processes are given access to resources in a timely manner.

5. Are there any limitations to achieving "bounded waiting" in computer systems?

One limitation is the possibility of deadlock, where two or more processes are waiting for each other to release resources, resulting in a deadlock situation. Another limitation is the potential for resource starvation, where a low-priority process may never be granted access to resources if higher-priority processes are continuously requesting them.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • STEM Academic Advising
Replies
6
Views
1K
  • Art, Music, History, and Linguistics
Replies
13
Views
1K
  • STEM Academic Advising
Replies
1
Views
608
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Programming and Computer Science
Replies
4
Views
750
  • Mechanical Engineering
Replies
28
Views
2K
  • Topology and Analysis
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
4K
Back
Top