Title: CS 352
1CS 352
2Turn-based Protocols
- So far, protocols have either had fixed slots, or
distributed control and random access to the
channel - What if we want to better control access to the
channel? - Sometimes, some senders must have absolute
priority (e.g. a brake controller) - Well present 2 solutions
- Reservation protocols
- Bit Mapped protocol
- Binary Countdown protocol (e.g. I2C, CAN buses)
- Token passing protocols (Token Ring, Fiber
Distributed Data Interface (FDDI))
3Bit Mapped Protocol
- Two phases contention schedule and data phase
- Schedule is which stations want to transmit in
the slot - Stations follow with data in the order they are
numbered - Who numbers the stations?
4Bit-Map Protocol
- Contention and data transmission periods
alternate - The contention period is divided into slots, with
1 bit-wide slots for each host in the network. - If a host wants to transmit a packet, it sets its
contention slot equal to 1. Otherwise, it sets
it to 0. - The slots pass all hosts in sequence, so every
host is aware of who will transmit
1
1
1
1
1
1
2
4
5
6
0
4
01234567
01234567
data frame
5Bit-Map Protocol
- But what if there are a large number of hosts in
the network? - The contention period will have to grow to
include them all - With a large number of hosts, the contention
period may be very long, leading to inefficiency
6 Binary Countdown Protocol
- During contention period,
- each host broadcasts its binary address one bit
at a time, starting with the most significant bit - bits transmitted simultaneously are boolean ORd
together - This is an electrical property of the bus used.
-
- Arbitration rule
- If a host sent a zero bit but the boolean OR
results in a one bit, the host gives up and stops
sending address bits - It drops out of the contention period
- Whichever host remains after the entire address
has been broadcast gets access to the medium - The winner
7Binary Countdown (contd)
Bit Time
0 1 2 3
0 - - -
0 - - -
1 0 0 -
Host
1 0 1 0
- dropped out
Time
8Binary Countdown Fairness
- Stations with the highest addresses will always
win. - This is good if you want to implement priority,
but bad if you want to give all hosts fair access
to the channel - Used in CAN-bus networks (cars), I2C bus (on a
motherboard) - Solution
- Change the address of a host after a successful
transmission
9Binary Countdown Permuting Addresses
- After a host A successful transmits, all hosts
with addresses less than A add one to their
address, improving their priority - Host A changes its address to zero, giving it the
lowest priority - Eventually, all hosts lt A get to transmit
10Token Ring
- IEEE 802.5 Standard
- Layers specified by 802.5
- Token Ring Physical Layer
- Token Ring MAC Sublayer
11Token Ring (contd)
- Token Ring, unlike Ethernet, requires an active
interface
Host
Ring interface
12Token Ring Configuration
13Token Ring Physical Layer
- Ring Interfaces
- Listen and Transmit Modes
- Channel Logic
- Differential Manchester Encoding
14Token Ring Interface Modes
Listen Mode
Transmit Mode
one-bit delay
To station
From station
To station
From station
15Differential Manchester Encoding
1 0 0 1 1
- Transitions take place at midpoint of interval
- 1 bit the initial half of the bit interval
carries the same polarity as the second half of
the previous interval - 0 bit a transition takes place at both the
beginning and the middle of the bit interval
16Token Ring MAC Sublayer
- Token passing protocol
- Frame format
- Token format
17Token Passing Protocol
- A token (8 bit pattern) circulates around the
ring - Token state
- Busy 11111111
- Idle 11111110
18Token Passing Protocol (contd)
- General Procedure
- Sending host waits for and captures an idle token
- Sending host changes the token to a frame and
circulates it - Receiving host accepts the frame and continues to
circulate it - Sending host receives its frame, removes it from
the ring, and generates an idle token which it
then circulates on the ring
19Token Ring Frame and Token Formats
1 1 1
Bytes
SD
AC
ED
Token Format
1 1 1 2/6 2/6
unlimited 4 1 1
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
Frame Format
20Token Ring Delimiters
SD
AC
ED
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- SD Starting Delimiter
- ED Ending Delimiter
- They contains invalid differential Manchester
codes
21Token Ring Access Control Field
SD
AC
ED
(Note The AC field is also used in frames)
P P P T M R R R
- P Priority bits
- provides up to 8 levels of priority when
accessing the ring - T Token bit
- T0 Token
- T1 Frame
22Token Ring Access Control Field (contd)
SD
AC
ED
P P P T M R R R
- M Monitor Bit
- Prevents tokens and frames from circulating
indefinitely - All frames and tokens are issued with M0
- On passing through the monitor station, M is
set to 1 - All other stations repeat this bit as set
- A token or frame that reaches the monitor station
with M1 is considered invalid and is purged
23Token Ring Access Control Fields (contd)
SD
AC
ED
P P P T M R R R
- R Reservation Bits
- Allows stations with high priority data to
request (in frames and tokens as they are
repeated) that the next token be issued at the
requested priority
24Token Ring Frame Control Field
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- FC Frame Control Field
- Defines the type of frame being sent
- Frames may be either data frames or some type of
control frame. Example control frames - Beacon Used to locate breaks in the ring
- Duplicate address test Used to test if two
stations have the same address
25Token Ring Address Data Fields
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- Address Fields
- Indicate the source and destination hosts
- Broadcast
- Set all destination address bits to 1s.
- Data
- No fixed limit on length
- Caveat Hosts may only hold the token for a
limited amount of time (10 msec)
26Token Ring Checksum and Frame Status
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- Checksum 32-bit CRC
- FS Frame Status
- Contains two bits, A and C
- When the message arrives at the destination, it
sets A1 - When the destination copies the data in the
message, it sets C1
27The Token Ring Monitor Station
- One station on the ring is designated as the
monitor station - The monitor station
- marks the M bit in frames and tokens
- removes marked frames and tokens from the ring
- watches for missing tokens and generates new ones
after a timeout period
28Using Priority in Token Ring
- If a host wants to send data of priority n, it
may only grab a token with priority value n or
lower. - A host may reserve a token of priority n by
marking the reservation bits in the AC field of a
passing token or frame - Caveat The host may not make the reservation if
the token or frames AC field already indicates a
higher priority reservation - The next token generated will have a priority
equal to the highest reserved priority
29Priority Transmission Example
B
A
C
D
Host B has 1 frame of priority 3 to send to
A Host C has 1 frame of priority 2 to send to
A Host D has 1 frame of priority 4 to send to
A Token starts at host A with priority 0 and
circulates clockwise Host C is the monitor
station
30Example (contd)
Event Token/Frame AC Field A
generates a token P0, M0, T0, R0 B
grabs the token and sets the message destination
to A P3, M0, T1, R0 Frame arrives at C,
and C reserves priority level 2. Monitor bit
set. P3, M1, T1, R2 Frame arrives at D,
and D attempts to reserve priority level 4 P3,
M1, T1, R4 Frame arrives at A, and A copies
it P3, M1, T1, R4 Frame returns to B, so B
removes it, and generates a new token P4, M0,
T0, R0 Token arrives at C, but its priority
is too high. C reserves priority 2. M bit. P4,
M1, T0, R2
31Example (contd)
- Event Token/Frame AC Field
- Token arrives at D, and D grabs
- it, sending a message to A P4,
M0, T1, R2 - Frame arrives at A, and A
- copies it P4, M0, T1, R2
- Frame arrives at B, which does
- nothing to it P4, M0, T1, R2
- Frame arrives at C, which sets the
- monitor bit P4, M1, T1, R2
- Frame returns to D, so D removes
- it and generates a new token with P2 P2, M0,
T0, R0 - etc Attempt to complete this scenario on your
own.