CompSci 356: Computer Network Architectures Lecture 5: Reliable - - PowerPoint PPT Presentation

compsci 356 computer network architectures lecture 5
SMART_READER_LITE
LIVE PREVIEW

CompSci 356: Computer Network Architectures Lecture 5: Reliable - - PowerPoint PPT Presentation

CompSci 356: Computer Network Architectures Lecture 5: Reliable Transmission and Multi-access links Chapter 2.4, 2.5, 2.6 Xiaowei Yang xwy@cs.duke.edu Overview Link layer functions Encoding NRZ, NRZI, Manchester, 4B/5B Framing


slide-1
SLIDE 1

CompSci 356: Computer Network Architectures Lecture 5: Reliable Transmission and Multi-access links Chapter 2.4, 2.5, 2.6

Xiaowei Yang xwy@cs.duke.edu

slide-2
SLIDE 2

Overview

  • Link layer functions

– Encoding

  • NRZ, NRZI, Manchester, 4B/5B

– Framing

  • Byte-oriented, bit-oriented, time-based
  • Bit stuffing

– Error detection

  • Parity, checkshum, CRC

– Reliability

  • FEC, sliding window
  • Multi-access links
slide-3
SLIDE 3

Error detection

  • Error detection code adds redundancy

– Analogy: sending two copies – Parity – Checksum – CRC

  • Error correcting code
slide-4
SLIDE 4

Two-dimensional parity

  • Even parity bit

– Make an even number of 1s in each row and column

  • Detect all 1,2,3-bit errors, and most 4-bit errors

A sample frame of six bytes

slide-5
SLIDE 5

Internet checksum algorithm

  • Basic idea (for efficiency)

– Add all the words transmitted and then send the sum. – Receiver does the same computation and compares the sums

  • IP checksum

– Adding 16-bit short integers using 1’s complement arithmetic – Take 1’s complement of the result

  • Used by lab 2 to detect errors
slide-6
SLIDE 6

1’s complement arithmetic

  • -x is each bit of x inverted
  • If there is a carry bit, add 1 to the sum
  • [-2^(n-1)-1, 2^(n-1)-1]
  • Example: 4-bit integer

– -5 + -2 – +5: 0101; -5: 1010; – +2: 0010; -2: 1101; – -5 + -2 = 1010+1101 = 0111 + one carrier bit; – à1000 = -7

slide-7
SLIDE 7

Calculating the Internet checksum

  • u_short cksum (u_short *buf, int count) {

register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred. So wrap around */ sum &= 0xFFFF; sum++; } } // one’s complement sum return ~(sum & 0xFFFF); // one’s complement of the sum }

slide-8
SLIDE 8

Verifying the checksum

  • Adds all 16-bit words together, including the

checksum

  • 0: correct
  • 1: errors
slide-9
SLIDE 9

Remarks

  • Can detect 1 bit error
  • Not all two-bits
  • Efficient for software implementation
slide-10
SLIDE 10

Cyclic Redundancy Check

  • Cyclic error-correcting codes
  • High-level idea:

– Represent an n+1-bit message with an n degree polynomial M(x) – Divide the polynomial by a degree-k divisor polynomial C(x) – k-bit CRC: remainder – Send Message + CRC that is dividable by C(x)

slide-11
SLIDE 11

Polynomial arithmetic modulo 2

– B(x) can be divided by C(x) if B(x) has higher degree – B(x) can be divided once by C(x) if of same degree

  • x^3 + 1 can be divided by x^3 + x^2 + 1
  • The remainder would be 0*x^3 + 1*x^2 + 0*x^1 +

0*x^0 (obtained by XORing the coefficients of each term)

– Remainder of B(x)/C(x) = B(x) – C(x) – Substraction is done by XOR each pair of matching coefficients

slide-12
SLIDE 12

CRC algorithm

  • 1. Multiply M(x) by x^k. Add k zeros to
  • Message. Call it T(x)
  • 2. Divide T(x) by C(x) and find the remainder
  • 3. Send P(x) = T(x) – remainder
  • Append remainder to T(x)
  • P(x) dividable by C(x)
slide-13
SLIDE 13

An example

  • 8-bit msg

– 10011010

  • Divisor (3bit CRC)

– 1101 Msg sent: 11111001101

slide-14
SLIDE 14

How to choose a divisor

  • Arithmetic of a finite field
  • Intuition: unlikely to be divided evenly by an

error

  • Corrupted msg is P(x) + E(x)
  • If E(x) is single bit, then E(x) = xi
  • If C(x) has the first and last term nonzero, then

detects all single bit errors

  • Find C(x) by looking it up in a book
slide-15
SLIDE 15

Hardware implementation

  • Very efficient: XOR operations
  • Number of bits = k
  • 0 to k-1 registers (k-bit shift registers)
  • If nth (n < k) term is not zero, places an XOR

gate

  • x3 + x2 + 1
slide-16
SLIDE 16

Overview

  • Link layer functions

– Encoding

  • NRZ, NRZI, Manchester, 4B/5B

– Framing

  • Byte-oriented, bit-oriented, time-based
  • Bit stuffing

– Error detection

  • Parity, checkshum, CRC

– Reliability

  • FEC, sliding window
  • Multi-access links
slide-17
SLIDE 17

Reliable transmission

  • What to do if a receiver detects bit errors?
  • Two high-level approaches

– Forward error correction (FEC) – Retransmission

  • Acknowledgements

– Can be “piggybacked” on data packets

  • Timeouts
  • Also called Automatic repeat request (ARQ)
slide-18
SLIDE 18

Stop-and-wait

  • Send one frame, wait

for an ack, and send the next

  • Retransmit if times out
  • Note in the last figure

(d), there might be confusion: a new frame,

  • r a duplicate?
slide-19
SLIDE 19

Sequence number

  • Add a sequence number

to each frame to avoid the ambiguity

slide-20
SLIDE 20

Stop-and-wait drawback

  • Revisiting bandwidth-delay product

– Total delay/latency = transmission delay + propagation delay + queuing

  • Queuing is the time packet sent waiting at a router’s

buffer

  • Will revisit later (no sweat if you don’t get it now)
slide-21
SLIDE 21

Delay * bandwidth product

  • For a 1Mbps pipe, it takes 8 seconds to transmit 1MB. If the

link latency is less than 8 seconds, the pipe is full before all data are pumped into the pipe

  • For a 1Gbps pipe, it takes 8 ms to transmit 1MB.
slide-22
SLIDE 22

Stop-and-wait drawback

  • A 1Mbps link with a 100ms two-way delay (round

trip time, RTT)

  • 1KB frame size
  • Throughput = 1KB/ (1KB/1Mbps + 100ms) =

74Kbps << 1Mbps

  • Delay * bandwidth = 100Kb
  • So we could send ~12 frames before the pipe is full!
  • Throughput = 100Kb/(1KB/1Mbps + 100ms) =

926Kbps

slide-23
SLIDE 23

Sliding window

  • Key idea: allowing

multiple outstanding (unacked) frames to keep the pipe full

slide-24
SLIDE 24

Sliding window on sender

  • Assign a sequence number (SeqNum) to each

frame

  • Maintains three variables

– Send Window Size (SWS) – Last Ack Received (LAR) – Last Frame Sent (LFS)

  • Invariant: LFS – LAR ≤ SWS
slide-25
SLIDE 25
  • Sender actions

– When an ACK arrives, moves LAR to the right,

  • pening the window to allow the sender to send

more frames – If a frame times out before an ACK arrives, retransmit

Slide window this way when an ACK arrives

slide-26
SLIDE 26

Sliding window on receiver

  • Maintains three window variables

– Receive Window Size (RWS) – Largest Acceptable Frame (LAF) – Last frame received (LFR)

  • Invariant

– LAF – LFR ≤ RWS

slide-27
SLIDE 27
  • When a frame with SeqNum arrives

– Discards it if out of window

  • Seq ≤ LFR or Seq > LAF

– If in window, decides what to ACK

  • Cumulative ack
  • Acks SeqNumToAck even if higher-numbered packets have

been received

  • Sets LFR = SeqNumToAck-1, LAF = LFR + RWS
  • Updates SeqNumToAck
slide-28
SLIDE 28

Finite sequence numbers

  • Things may go wrong when SWS=RWS, SWS too

large

  • Example

– 3-bit sequence number, SWS=RWS=7 – Sender sends 0, …, 6; receiver acks, expects (7,0, …, 5), but all acks lost – Sender retransmits 0,…,6; receiver thinks they are new

  • SWS < (MaxSeqNum+1)/2

– Alternates between first half and second half of sequence number space as stop-and-wait alternates between 0 and 1

slide-29
SLIDE 29

Sliding window protocol (SWP) implementation

typedef u_char SwpSeqno; typedef struct { SwpSeqno SeqNum; /* sequence number of this frame */ SwpSeqno AckNum; /* ack of received frame */ u_char Flags; /* up to 8 bits' worth of flags. An ack or data */ } SwpHdr;

Your code will look very different!

slide-30
SLIDE 30

typedef struct { /* sender side state: */ SwpSeqno LAR; /* seqno of last ACK received */ SwpSeqno LFS; /* last frame sent */ Semaphore sendWindowNotFull; SwpHdr hdr; /* preinitialized header */ struct sendQ_slot { Event timeout; /* event associated with send-timeout */ Msg msg; } sendQ[SWS]; /* receiver side state: */ SwpSeqno NFE; /* seqno of next frame expected */ struct recvQ_slot { int received; /* is msg valid? */ Msg msg; } recvQ[RWS]; } SwpState;

slide-31
SLIDE 31

static int sendSWP(SwpState *state, Msg *frame) { struct sendQ_slot *slot; hbuf[HLEN]; /* wait for send window to open */ semWait(&state->sendWindowNotFull); state->hdr.SeqNum = ++state->LFS; slot = &state->sendQ[state->hdr.SeqNum % SWS]; store_swp_hdr(state->hdr, hbuf); msgAddHdr(frame, hbuf, HLEN); msgSaveCopy(&slot->msg, frame); slot->timeout = evSchedule(swpTimeout, slot, SWP_SEND_TIMEOUT); return sendLINK(frame); }

slide-32
SLIDE 32

static int deliverSWP(SwpState state, Msg *frame) { SwpHdr hdr; char *hbuf; hbuf = msgStripHdr(frame, HLEN); load_swp_hdr(&hdr, hbuf) if (hdr->Flags & FLAG_ACK_VALID) { /* received an acknowledgment---do SENDER side */ if (swpInWindow(hdr.AckNum, state->LAR + 1, state->LFS)) { do { struct sendQ_slot *slot; slot = &state->sendQ[++state->LAR % SWS]; evCancel(slot->timeout); msgDestroy(&slot->msg); semSignal(&state->sendWindowNotFull); } while (state->LAR != hdr.AckNum); } }

slide-33
SLIDE 33

if (hdr.Flags & FLAG_HAS_DATA) { struct recvQ_slot *slot; /* received data packet---do RECEIVER side */ slot = &state->recvQ[hdr.SeqNum % RWS]; if (!swpInWindow(hdr.SeqNum, state->NFE, state->NFE + RWS - 1)) { /* drop the message */ return SUCCESS; } msgSaveCopy(&slot->msg, frame); slot->received = TRUE; if (hdr.SeqNum == state->NFE) { Msg m; while (slot->received) { deliverHLP(&slot->msg); msgDestroy(&slot->msg); slot->received = FALSE; slot = &state->recvQ[++state->NFE % RWS]; } /* send ACK: */ prepare_ack(&m, state->NFE - 1); sendLINK(&m); msgDestroy(&m); }} return SUCCESS; }

slide-34
SLIDE 34

static bool swpInWindow(SwpSeqno seqno, SwpSeqno min, SwpSeqno max) { SwpSeqno pos, maxpos; pos = seqno - min; /* pos *should* be in range [0..MAX)*/ maxpos = max - min + 1; /* maxpos is in range [0..MAX]*/ return pos < maxpos; }

slide-35
SLIDE 35

Multiple functions of the sliding window algorithm

  • Remark: perhaps one of the best-known

algorithms in computer networking

  • Multiple functions

– Reliable deliver frames over a link – In-order delivery to upper layer protocol – Flow control

  • Not to over un a slow slower

– Congestion control (later)

  • Not to congest the network
slide-36
SLIDE 36

Other ACK mechanisms

  • NACK: negative acks for packets not received

– unnecessary, as sender timeouts would catch this information

  • SACK: selective ACK the received frames

– + No need to send duplicate packets – - more complicated to implement – Newer version of TCP has SACK

slide-37
SLIDE 37

Exercise

  • Delay: 100ms; Bandwidth: 1Mbps; Packet

Size: 1000 Bytes; Ack: 40 Bytes

  • Q: the smallest window size to keep the pipe

full?

slide-38
SLIDE 38
  • Window size = largest amount of unacked data
  • How long does it take to ack a packet?

– RTT = 100 ms * 2 + transmission delay of a packet (1000B) + transmission delay of an ack (40B) ~=208ms

  • How many packets can the sender send in an

RTT?

– 1Mbps * 208ms / 8000 bits = 26

  • Roughly 13 packets in the pipe from sender to

receiver, and 13 acks from receiver to sender

100ms 1Mbps

slide-39
SLIDE 39

Concurrent logical channels

  • A link has multiple logical channels
  • Each channel runs an independent stop-and-

wait protocol

  • + keeps the pipe full
  • - no relationship among the frames sent in

different channels: out-of-order

slide-40
SLIDE 40

Multi-access links

  • Multiple access links

– Ethernet – 802.11 (WiFi) – Bluetooth – Cell phone – Note: understand the concepts

slide-41
SLIDE 41

Original design

  • 802.3 standard defines both MAC and physical

layer details

  • Motivation: switches are expensive

Metcalfe’s original Ethernet Sketch

slide-42
SLIDE 42

Multiple-access links

  • Many nodes attached to the same link

– Ethernet – Token rings – Wireless network (WiFi)

  • Problem: who gets to send a frame?

– Multiple senders lead to collision

  • Solution: a general technique

– Multiple access with collision detect (CSMA/CD)

  • Bus LAN
  • Ring LAN
slide-43
SLIDE 43

Ethernet

  • Developed in mid-1970s at Xerox PARC
  • Speed: 10Mbps -- 10 Gbps
  • Standard: 802.3, Ethernet II (DIX, stands for Digital-Intel-

Xerox)

  • Most popular physical layers for Ethernet

– Last digital shows segment length

  • 10Base5

Thick Ethernet: 10 Mbps coax cable. A segment < 500m

  • 10Base2

Thin Ethernet: 10 Mbps coax cable. < 200 m

  • 10Base-T

10 Mbps T: Twisted Pair < 100m

  • 100Base-TX 100 Mbps over Category 5 twisted pair, duplex
  • 100Base-FX 100 Mbps over Fiber Optics, duplex
  • 1000Base-FX 1Gbps over Fiber Optics, duplex
  • 10000Base-FX 10Gbps over Fiber Optics (for wide area links), duplex
slide-44
SLIDE 44

Bus Topology

Ethernet

  • 10Base5 (thick) and 10Base2 (thin) Ethernets

have a bus topology

  • 10Base5 as our case study

10BASE2 cable T-connector Terminator

slide-45
SLIDE 45

Physical properties

Sensing the line; if idle, sends signals 10Base5 Transceiver

q A small device directly attached to the tap q It detects when the line is idle and drives the signal when the host is transmitting q It also receives incoming signals.

slide-46
SLIDE 46

How to expand an Ethernet segment

  • A repeater is a device that

forwards digital signals

– Multiple segments can be joined together by repeaters

  • No more than four

repeaters between any host

– <2500 meters

  • < 1024 hosts
  • Terminators are attached to

each end of the segment

  • Manchester encoding
slide-47
SLIDE 47
  • Starting with 10Base-T, stations are connected

to a hub (or a switch) in a star configuration

  • 100Mbps, 1000Mbps

How to expand an Ethernet segment (II)

Hub

10 Base-T cable and jack

A hub is a multiway repeater

slide-48
SLIDE 48

Collision Domain

  • Any host hears any other host

– A single segment – Multiple segments connected by repeaters – Multiple segments connected by a hub

q All these hosts are competing for access to the same link, and as a consequence, they are said to be in the same collision domain.

slide-49
SLIDE 49

Access control

  • Bit-oriented framing
  • In a host’s memory, Ethernet header is 14 bytes
  • The adaptor adds the preamble and CRC
  • The type field is the de-multiplexor
  • 46-1500 bytes of data

– Pad to minimum length – Minimum length is for collision detection

  • 802.3 has the same header format, but substitutes type with

length field

– How to tell whether the field indicates type or length?

  • All types > 1500B
slide-50
SLIDE 50

A prettier picture

  • You’ll need to know this for Lab 2
slide-51
SLIDE 51

Ethernet addresses

  • A flat unique 6-byte address per adaptor

– 00-13-E8-6D-8C-3D

  • Each manufacture is given a unique prefix

– e.g: 8:0:20:??:??:?? - Advanced Micro Devices (AMD)

  • An all 1s address is a broadcast address (FF:FF:FF:FF:FF:FF)
  • An address with first bit 1 but not broadcast is multicast
  • An adaptor receives

– Frames with its address as a destination address – In promiscuous mode, delivers all frames – Broadcast frames – Multicast frames if configured to

slide-52
SLIDE 52

Transmitter Algorithm (1)

  • 1. The adaptor receives datagram from network layer, creates

frame

  • 2. If the adaptor senses channel idle, starts frame transmission. If

NIC senses channel busy, waits until channel idle, then transmits.

  • 3. If NIC transmits an entire frame without detecting another

transmission, NIC is done with frame!

  • 4. If NIC detects another transmission while transmitting, aborts

and sends jam signal (collision!!)

slide-53
SLIDE 53

Transmitter Algorithm (2)

  • If collision…

– jam for 32 bits, then stop transmitting frame – Wait and try again

  • exponential backoff (doubling the delay interval of

each collision)

  • After the nth collision:: the adaptor waits for k x

51.2us, for randomly selected k=0, …, 2n – 1

– 1st time: 0 or 51.2us – 2nd time: 0, 51.2, 102.4, or 153.6us

– …

  • give up after several tries (usually 16)
slide-54
SLIDE 54

Collision detection

  • An adaptor senses the signals on the line and

compares it with its own

– If same, no collision; otherwise, collision – Sends 32-bit jamming sequence after collision

  • In the worst case, a sender needs to send 512 bits

(46+14+4 = 64B) to detect collision

– Why?

slide-55
SLIDE 55

q A and B are at opposite ends of the network q One way delay is d q A needs to send for 2d (round-trip delay) to detect collision q 2d = 51.2 µs. On a 10Mps Ethernet, corresponds to 512 bits

q Related to maximum Ethernet length ~ 2500 m

(a) A sends a frame at time t ;

(d) B’s runt (32-bit) frame arrives at A at time t + 2d. (c) B begins transmitting at time t + d and immediately collides with A’s frame;

(b) A’s frame arrives at B at time t + d;

slide-56
SLIDE 56
  • The IEEE 802.3 Baseband 5-4-3

– Five physical segments between any two nodes – Four repeaters between the nodes. – Three of these physical segments can have connected node

  • Each segment < 500m à Total < 2500m
slide-57
SLIDE 57
  • Propagation delay for this maximum-extent

Ethernet network is 25.6us

  • 2*d = 51.2us
  • Minimum Ethernet packet frame is 512 bits

(64B)

– Header 14B, payload 46B, CRC 4B

slide-58
SLIDE 58

Ethernet experience

  • 30% utilization is heavy
  • Most Ethernets are not light loaded
  • Very successful

– Easy to maintain – Price: does not require a switch which used to be expensive

slide-59
SLIDE 59

Wireless links

  • Most common

– Asymmetric

  • Point-to-multipoint
slide-60
SLIDE 60

Wireless access control

  • Can’t use Ethernet protocol

– Hidden terminal

  • A and C can’t hear each other’s collision at B

– Exposed terminal

  • B can send to A; C can send to D
slide-61
SLIDE 61

802.11 (WiFi) Multiple access with collision avoidance

  • Sender and receiver exchange control

– Sender à receiver: Request to send (RTS)

  • Specifies the length of frame

– Receiver à sender: Clear to send (CTS)

  • Echoes length of frame

– Sender à receiver: frame – Receiver à sender: ack – Other nodes can send after hearing ACK

  • Node sees CTS

– Too close to receiver, can’t transmit – Addressing hidden terminals

  • Node only sees RTS

– Okay to transmit – Addressing exposed terminals

slide-62
SLIDE 62

How to resolve collision

  • Sender can’t do collision detection

– Single antenna can’t send and receive at the same time

  • If no CTS, then RTS collide
  • Exponential backoff to retransmit
slide-63
SLIDE 63

Distribution system

  • Hosts associate with APs
  • APs connect via the distribution system

– A layer-2 system

  • Ethernet, token ring, etc.

– Host IP addresses do not need to change

slide-64
SLIDE 64

AP association

  • Active scanning

– Node: Probe – APs: Probe response – Node selects one of APs, send Association request – AP replies Association Response

  • Passive scanning

– AP sends Beacon to announce itself – Node sends Association Request

slide-65
SLIDE 65

Frame format

  • Same AP

– Addr1: dst – Addr2: src

  • Different Aps

– ToDS and FromDS in control field set – Add1: dst, Addr2: AP_dst – Addr3: AP_src, Add4: src

slide-66
SLIDE 66

Bluetooth

  • Connecting devices: mobile phones, headsets,

keyboards

– Very short range communication – Low power

  • License exempt band 2.45 Ghz
  • 1~3Mpbs
  • Specified by Bluetooth Special Interest Group
slide-67
SLIDE 67

A bluetooth piconet

  • A master device and up to seven slave devices
  • Communication is between the master and a slave
slide-68
SLIDE 68

Bluetooth uses a spread spectrum technique

  • Frequency-hopping with 79 channels
  • Each for 625 us
  • A frame takes up 1, 3, or 5 slots
  • The master can start in odd-numbered slots
  • A salve can start in an even-numbered slot, in

response to a request from the master

  • A slave device can be parked

– In active, low power, only be reactivated by the master

slide-69
SLIDE 69

Cell phone technologies

  • Using licensed spectrum
  • Europe: 900 Mhz and 1800 Mhz
  • North America: 850 Mhz and 1900 Mhz
  • Base stations form a wired network
  • Geographic area served by a base station’s

antenna is called a cell

– Similar to wifi

  • Phone is associated with one base station
  • Leaving a cell entering a cell causes a handoff
slide-70
SLIDE 70

Cellular technologies

  • 1G: analog
  • 2G: digital and data
  • 3G: higher bandwidth and simultaneous voice

and data

– Variants of Code Division Multiple Access (CDMA) – A spread spectrum technology – Each transmitter uses a pseudorandom chipping code using a wide spectrum – Good for bursty traffic: no hard limit on how many users can send simultaneously

  • 4G: even higher
slide-71
SLIDE 71

Summary

  • A new reliable transmission mechanism

– Current logical channels

  • Multiple access links

– Ethernet – 802.11 (WiFi) – Bluetooth – Cell phone – Note: understand the concepts

  • Lab 1 out: much harder than Lab 0. Pls start

early!

slide-72
SLIDE 72

Backup

slide-73
SLIDE 73

Token rings

  • A token circulates the ring
  • If a node has something to

send, take the token off the ring, and send the frame

– Node 1

  • Each node along the way

simply forwards the frame

  • Receiver copies the frame

– Node 4

  • Frame comes back to sender

– Sender removes the packet and puts the token back

slide-74
SLIDE 74

Token ring standard

  • IBM Token Ring
  • A nearly identical IEEE standard

– 802.5: not widely used

  • Fiber Distributed Data Interface (FDDI)

– Derived from the IEEE 802.4

  • Resilient Packet Ring (RPR)

– 802.17

slide-75
SLIDE 75

Challenges must be addressed

  • Fault tolerance
  • Media access control

– How long each node can hold the token?

  • Reliability

– How does the sender know the frame is received

  • Resource utilization
slide-76
SLIDE 76

Adding fault tolerance

  • Problem: single node powers off disconnects the

ring

  • Solution: relay that closes when host’s powered
  • ff

an electromechanical relay

slide-77
SLIDE 77

Token ring media access control

  • An adaptor has a receiver and a transmitter
  • Problem: how long can a node holds a token?

– Token holding time (THT), default 10ms in 802.5 – Short: waste bandwidth – Long: starve others – What if you have an important short message?

slide-78
SLIDE 78

802.5 Token Access Protocol

  • A token has a 3-bit priority field
  • A frame has three reservation bits

– A device seizes the token if its packet is at least as the token – Reservation

  • A sender X sets priority n in the three reservation bits in

a frame if

– The bits are not set to a higher value

  • The station that holds the token set priority to n

– Sender X lowers the token priority after releasing it so other senders can send – Drawback: may starve lower priority traffic

slide-79
SLIDE 79

Token ring reliability

  • No sliding window!
  • Two trailing bits (A, C) after each frame

– A recipient sets A bit when it sees the frame – Sets C bit after it copies the frame back to its adaptor – If a sender does not see both bits set, retransmits

q A=0, C=0: the intended recipient is not functioning or absent q A=1, C=0: for some reason (e.g., lack of buffer space), the destination could not accept the frame q A=1, C=1: frame received

slide-80
SLIDE 80

When to release a token

  • Which one is better?

– 802.5 originally used (b), and adds (a) later

Early release: Sender inserts the token back onto the ring immediately following its frame Late release: Sender inserts the token after the frame it transmits has gone all the way around the ring and been removed

Better bandwidth utilization

slide-81
SLIDE 81

802.5 Token ring maintenance

  • A monitor makes sure the token is not lost

– Periodically announces itself

  • If the monitor fails

– A station elects itself by sending a claim token – If the token comes back, it’s the monitor – If competition, highest address wins

slide-82
SLIDE 82

Monitor’s job

  • If it does not see a token for a long time, it creates a

new one

– # of stations * token holding time + ringLatency

  • Detect and remove orphaned frames (whose “parent”

died) – Monitor sets a head bit to 1 after seeing a frame – If it sees the bit already set, remove the packet

slide-83
SLIDE 83

802.5 Frame format

q Similar to the Ethernet, 802.5 addresses are 48 bits long. q The frame also includes a 32-bit CRC. q Frame status byte includes the A and C bits for reliable delivery

slide-84
SLIDE 84

Transmitter Algorithm

Begin: Wait until the line is idle and has data to send, the adaptor sends it, and listens to collision

– If no, go back to Begin – else exponentially backoff

  • randomly selects a k between [0,2n-1], waits for k x

51.2 µs to try Begin again

  • Gives up after n reaches 16
slide-85
SLIDE 85
  • One way delay is d
  • A needs to send for 2d duration to detect collision
  • 2d = 512 µs. On a 10Mps Ethernet, corresponds to 512 bits
slide-86
SLIDE 86

Token rings

  • A token circulates the ring
  • If a node has something to

send, take the token off the ring, and send the frame

  • Receiver copies the frame
  • Frame comes back to sender
  • Sender removes the packet

and puts the token back

slide-87
SLIDE 87

When to release a token

  • A) early; b) late
  • Which one is better?

– 802.5 has a,b