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.
Algorithm for a bi-directional token ring that has 7 nodes, 3 byte token. Node 2, 5...
write a C or Fortran program that sends a token in a ring for an arbitrary number of nodes: Create a directory in your home directory titled exactly PA1. Make sure you have ALL code located in this directory. 4. Write a makefile that will compile your code. 5. Use MPI to send a token in a ring for any number of nodes 6. Verify that your code is working correctly. 7 Write a C program that sends a token...
2. Consider a set of intersecting rings as in the following
figure. Here, a small square represents a node, including nodes
that can transfer packets between rings, and each ring has an arrow
that indicates the direction of packet flow on that ring. Each ring
is labeled by a lower case Greek letter with the first ring labeled
α .
2.1. Display the adjacency matrix for the network in the
figure.
2.2. Which, if any, nodes are equivalent on the...
2. Write a recursive algorithm which computes the number of nodes in a general tree. 3. Show a tree achieving the worst-case running time for algorithm depth. 4. Let T be a tree whose nodes store strings. Give an efficient algorithm that computes and prints, for every node v of T, the string stored at v and the height of the subtree rooted at v. Hin Consider 'decorating' the tree, and add a height field to each node (initialized to...
4. Given a network of 8 nodes and the distance between each node as shown in Figure 1: 4 1 7 0 4 4 6 6 Figure 1: Network graph of 8 nodes a) Find the shortest path tree of node 1 to all the other nodes (node 0, 2, 3, 4, 5, 6 and 7) using Dijkstra's algorithm. b) Design the Matlab code to implement Dijkstra's algorithm
4. Given a network of 8 nodes and the distance between each...
Consider a tree with 13 nodes: the root has 4 children and each of these children has 2 children. Consider the following greedy algorithm for vertex cover: add the node with the highest degree to the vertex cover, remove all edges incident to this node, and repeat until there are no edges left. What approximation ratio is achieved by the algorithm on this graph? Give your answer to 2 decimal places. Can someone help me with this question? Thanks.
A transportation network has 10 nodes. Distances of roads between nodes are shown in Table 1. Total five emergency vehicles are located at nodes 2,4, 5, 7, and 9. There is one vehicle at each of these five nodes. The vehicles must travel to destination nodes 1, 3, 6, 8 and 10. Each destination node will have one vehicle. Suppose that emergency vehicles may travel along both directions of any road shown in Table 1. Please apply the Dijkstra's algorithm...
Given the following distances between destination nodes, what is the minimum distance that connects all the nodes? From Node To Node Distance 1 1 2 150 2 1 3 200 3 2 3 100 4 2 4 200 5 2 5 50 6 3 4 350 7 3 5 300 8 4 6 100 9 5 6 100 NOTE: You have to show your work. Do not use EXCEL QM Identify decision variables Formulate the LP problem by showing objective...
QUESTION 1 In a tree, a ____ is a node with successor nodes. root child descendent parent sibling QUESTION 2 In a tree, the ____ is a measure of the distance from a node to the root. count degree branch height level QUESTION 3 Which of the following is not a characteristic of a binary search tree? Each node has zero, one, or two successors. The preorder traversal processes the node first, then the left subtree, and then the right...
s children nodes Finding the specific od'sbothers DAodging whether the specifie node is leaf or by the adjacent matrix, then the matrix gr Gwith n vertices, ㅲt is 10. Ifthe binary tree is stored by the Judge if the node is on the same level D Find the node position acording to its eenial method, which operation is easy to implement? 10 l Answer are Il True or False ( 10 POINTS) 2. The insertion and deletion 3. Sequential storage...