A token ring network is a type of local area network, configured in either a ring or star topology, where a bit sequence called a token is used to grant write access to the network. Only the host(s) with a token is/are permitted to transmit data on the network. Control in a token ring network can either be centralized, where a central controller distributes the token(s) to hosts, or it can be decentralized, where hosts pass the token(s) between themselves. In both cases, tokens are typically distributed and passed in a circular and cyclic fashion.
Characteristics of Token Ring Networks
The following are characteristics of token rings:
- service in cyclic order
- implementations
- IEEE 802.4, token bus
- IEEE 802.5, IBM token ring
- Fiber Distributed Data Interface (FDDI) token ring
- polling system for use in token distribution
In ring topology token ring networks, point-to-point links connect stations in a closed loop, where frames are transmitted and travel only a single direction around the ring. Each intermediate station between the transmitting host and the destination host receives and regenerates the frame (but does not store/copy it locally). The delay incurred for a host to receive a frame, inspect the header, and determine whether or not to forward the packet adds a delay of a few bits at each intermediate host. After the correct course of action is determined from the header, the intermediate host will forward the frame as the remainder of the frame is being received – this is an example of cut-through switching.
Removing a Frame from the Network
A problem with token ring networks, as we've discussed them so far, is that they pose the opportunity for the infinite forwarding of packets around the ring. How can we design a token ring network such that a transmitted frame is "removed" from the network? There are two options:
- the destination host removes the frame when it receives the frame and determines it is in face the destination
- the source/transmitting host removes the frame when it receives it back (i.e. when the frame traverses the entire ring topology and arrives back at the source)
Let's discuss what we mean by "remove" a frame from the network. In a token ring network, each host must receive the frame, check the headers, and retransmit the frame. If a host chooses to not retransmit a frame, it will effectively be removed from the network, since all hosts after the receiving host will never receive the frame.
Of the two options above, option 1 would allow the frame to only traverse the links required to make it to the destination, while option 2 utilizes all links between hosts. This means that in option 1, only the hosts between the source and the destination will know about the frame, while in option 2, all hosts will see the frame. It turns out that option 2 is a better choice in practice. Although it might seem less efficient, forcing a frame to traverse each host in the ring natively supports broadcast packets and aids in the implementation of some token ring protocol features.
Pros and Cons of Token Rings
Like many things in life, as well as in networking, there are both benefits and drawbacks to token ring networks. Advantages include:
- simple implementation due to fixed path
- routing is unnecessary
- frame incurs small delay at each host
- can span wide geographic areas
- very efficient for heavy traffic
while disadvantages include:
- single point of failure
- inability to add/remove hosts w/o disrupting others
- delay increases as number of hosts in ring increases
Operation of a Token Ring NIC
Recall that a NIC is a network interface card, which implements the protocols of the underlying network and simply exposes an abstract network interface to the host for frame reception and transmission.
Like NICs for other types of networks, such as Ethernet, a token ring NIC supports two main operating modes – transmit mode and receive/listen mode.
Transmit Mode
In transmit mode, a token ring NIC will write a frame to the network. This frame will propagate to the next host in the ring, ..., which will eventually propagate back around to the source NIC. At this time, the source NIC will elect to not transmit the frame, thus removing the frame from the network.
Receive Mode
In receive mode, a token ring NIC will wait for a frame. When a frame arrives, it will read the destination address of the frame from the header. If the destination is the address of the host where the NIC is installed, the NIC will copy the frame to the host as well as retransmit the frame towards the next host in the network. If the destination address of the frame is not for the host where the NIC is installed, the NIC will simply retransmit the frame towards the next host in the network. The delay to check the destination address of the arriving frame is the retransmission delay, which is typically a small number of bits relative to the size of the frame.
Tokens
As discussed briefly, a token is what provides access control in a token ring network. Only devices with a token may transmit at a given time. There are two types of tokens – idle tokens and busy tokens. If a host is given an idle token, that host may initiate a transmission onto the (idle) network. On the other hand, if the host is passed a busy token, the host may not use the network, since it is being used (i.e. is busy) by another ongoing transmission.
A host with a buffer of data to transmit will operate in receive mode until it receives an idle token from the network. Once an idle token has been received, the host will transition to transmit mode and may transmit its accumulated buffer of data onto the network in the form of a frame. Until an idle token is received, or if a busy token is received by the host, the host must operate in receive mode, forwarding any received frames to the next host in the network (and copying frames to itself if it's the destination).