Question

Algorithm for a bi-directional token ring that has 7 nodes, 3 byte token. Node 2, 5...

Algorithm for a bi-directional token ring that has 7 nodes, 3 byte token. Node 2, 5 are both sending a packet to node one @ T=3. System cycle is 2 seconds.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Token ring algorithm is to achieve mutual exclusion in distributed system. A logical ring is constructed in which each process is assigned a position in the ring. Among several processes, one process acts as a coordinator. It is the coordinator’s task to generate a token and circulate the token around the ring, as needed. In this case, the token moves in both directions.

In the ring structure, every process maintains the current ring configuration of the system. If a process is removed or added into the system, then the updating must be reflected to all the processes’ ring configuration table. A ring configuration table is something that contains information about process id (PID), state of the processes and their status in the current system.

Algorithm working:

Consider, the processes are numbered as P1, P2, P3, P4, P5, P6, P7. For simplicity, consider process P1 wants to enter in its critical section. P1 will send a request [REQUEST (PID, TIMESTAMP_OF_REQUEST_GENERATION)] to the coordinator to acquire the token. A REQUEST message contains two parameters-
a) PID (i.e. process id of the requesting process),
b) Time Stamp of request generation.

Here, two cases may appear:

Case 1: - At this particular time, if no other process is executing in its critical section, and the coordinator retains the token, then the coordinator will send the token to the requesting process (P1). After acquiring the token, the process keeps the token and enters in its critical section. After exiting from the critical section the process returns the token to the coordinator. Case 2:- But, if some other process Pi (i != 1) is executing in its critical section, then the coordinator sends a WAIT signal, to the requesting process (P1) and the request from process P1 is stored in the REQUEST QUEUE, maintained by the coordinator only. In between, if any other processes want to enter into critical section and send request to the coordinator, then those requests will also be stored in the REQUEST QUEUE. When the coordinator gets back the token, then it sends the token to one of the waiting process in the REQUEST_QUEUE, which has smallest TIMESTAMP_OF_REQUEST_GENERATION.

One thing that we have to keep in mind, while a process is executing in its critical section, during that, with a certain time interval the process continually sends an EXISTS signal to the coordinator, to indicate that the token is alive. In reply of each EXISTS signal, the coordinator sends an OK signal to that process, indicating, the coordinator is alive also.

Add a comment
Know the answer?
Add Answer to:
Algorithm for a bi-directional token ring that has 7 nodes, 3 byte token. Node 2, 5...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT