Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: March 18, 2024
In this tutorial, we’ll explain the token access control protocol described in IBM’s token ring network article.
A controlled access protocol is a protocol in which a node has to wait for permission to send data. In contrast, random access protocols allow nodes in the network can send data at will.
In random access protocols, two nodes may collide if they send data simultaneously, which hampers efficiency. Controlled access protocols address this issue by allowing only one node to access the network at a time.
There are three types of controlled access protocols: reservation, polling, and token passing. The authorization mechanism differs for each protocol type.
The token access control protocol manages the data flow on a ring network. A node network can gain access to the network only if it has the token. Otherwise, it waits to get it.
The token access protocol divides the transferred data into units we call frames. There are two types of frame structures: the data and token frame structures.
The data frame structure contains a header, information, and trailer:
The physical header is a three-byte field composed of multiple parts:
The information part has two fields: the data link control field and the data field. Higher-level protocols use the data link control field. The data field has a variable length and contains the actual message.
Finally, we have the physical trailer:
The token frame structure used in the token access protocol is visible below:
The priority mode (PM) field combined with the priority reservation (PR) field makes available multiple priority levels.
The monitor count (MC) field has one bit. The MC field, along with the token monitor function, prevents the continuous flow of a frame around the network.
The token bit (T) field is a one-bit token indicator. It denotes if the frame is a token or a data frame.
The first node to connect to the network checks if there’s an active monitor. If not, it takes the role and issues a token.
The token moves around the ring, allowing nodes to send data. Once a node with data to send gets the token, it removes it from the ring and starts sending its data.
The receiving node captures and copies the data, sets the C-bit, and returns the data back to the network. The data then circulates the ring until it gets to the sender, who, in the meantime, is sending idle characters.
As soon as the sending node gets the frame indicating that the receiver copied the data, it will remove the frame it sent and return the token to the ring, giving other nodes a chance to transmit data. Hence, this guarantees that there’s always one token or data frame in the ring.
Let’s take an example from IBM’s token ring network article.
The ring network consists of five nodes. Initially, a token is issued by one of the nodes:
Node A removes the token from the network, changes the token bit to indicate a data frame, and sets the receiving address to node D’s address. Then, it starts to send its data:
The data circulate around the ring until node D recognizes that the data frame is addressed to it:
Then, node D captures the data, copies them, and sets the C-bit to indicate it has done so. Lastly, it returns the frame back to the network:
The data frame keeps circulating in the network until node A recognizes its source address:
Subsequently, node A removes the data from the network and issues the token:
Other nodes in the ring can now have a turn to gain access to the token.
A single node (active monitor) in the network is responsible for the token monitor function. The token monitor function includes monitoring the network for the disappearance of the token or the never-ending circulation of a frame.
The disappearance of the token can happen when the current token-issuing node crashes. The never-ending circulation of a frame can occur if the sending node never recognizes its physical address, and therefore the data frame keeps circulating the ring.
Both situations lead to an inaccessible ring. The active monitor node starts an error recovery procedure once it detects a fault in the network. All the other nodes in the network are ready to become active monitors in case there’s a failure in the current one.
In this article, we described the token access protocol. The token frame gives authorization to a network node to send data. A network node cannot gain access to the network unless it has captured the token.