1 the data link layer introduction point-to-point data link protocols the multiple access problem...

41
1 The Data Link Layer The Data Link Layer introduction introduction point-to-point data link point-to-point data link protocols protocols the multiple access problem the multiple access problem local area networks local area networks required reading: required reading: Tannenbaum ch 3, 4 Tannenbaum ch 3, 4 Kurose, Ross ch 5 Kurose, Ross ch 5

Post on 19-Dec-2015

227 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

1

The Data Link LayerThe Data Link Layer

introduction introduction point-to-point data link protocols point-to-point data link protocols the multiple access problem the multiple access problem local area networks local area networks required reading: required reading:

Tannenbaum ch 3, 4 Tannenbaum ch 3, 4 Kurose, Ross ch 5Kurose, Ross ch 5

Page 2: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

2

Data Link Layer : IntroductionData Link Layer : Introduction

Services:Services: reliably deliver a data link packet between two reliably deliver a data link packet between two physically connected machinesphysically connected machines

two link types: point-to-point, broadcast two link types: point-to-point, broadcast

Point-to-point links:Point-to-point links: one sender, one receiver one sender, one receiver framing: recognizing bits on the wire as packets framing: recognizing bits on the wire as packets reliable communications reliable communications

Page 3: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

3

Data Link Layer : IntroductionData Link Layer : Introduction

broadcast links:broadcast links: many senders, potentially many senders, potentially many receivers many receivers

framing framing reliable communication reliable communication accessing a shared medium accessing a shared medium addressing addressing many senders many receiversmany senders many receivers

Page 4: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

4

Data Link Layer: IntroductionData Link Layer: Introduction

reliable communication: ARQ, checksum, reliable communication: ARQ, checksum, timers, sequence numbers timers, sequence numbers

addressing addressing data link level addresses different from network data link level addresses different from network

layer addresses! layer addresses! why do we need different data link address? why do we need different data link address?

Page 5: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

5

Data Link Layer ServicesData Link Layer Services

Three possible services provided to network layerThree possible services provided to network layer Unacknowledged connectionless serviceUnacknowledged connectionless service

– no error recovery, suitable for low error rate channelsno error recovery, suitable for low error rate channels Acknowledged connectionless serviceAcknowledged connectionless service

– suitable for unreliable channelssuitable for unreliable channels Acknowledged connection-oriented serviceAcknowledged connection-oriented service

– suitable for WAN subnets connected by point-to-point suitable for WAN subnets connected by point-to-point leases linesleases lines

Page 6: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

6

ARQ-based ProtocolsARQ-based Protocols

Automatic repeat request (ARQ)Automatic repeat request (ARQ) detect transmission errors and request retransmissiondetect transmission errors and request retransmission

Stop-and-wait ARQStop-and-wait ARQ ensure each packet has been received correctly before ensure each packet has been received correctly before

sending next; uses acks/nackssending next; uses acks/nacks need to use sequence numbers need to use sequence numbers

Go back n ARQGo back n ARQ send packets numbered sequentiallysend packets numbered sequentially receiver sends ack with the largest in-order packet receivedreceiver sends ack with the largest in-order packet received n determines how many packets can be sent before waitingn determines how many packets can be sent before waiting

Page 7: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

7

Error detection and CorrectionError detection and Correction

Parity checksParity checks one bit parity for every n bitsone bit parity for every n bits two dimensional paritytwo dimensional parity

ChecksumsChecksums Cyclic redundancy checksCyclic redundancy checks

add add rr bits to a bits to a d d bit string such that bit string such that (d+r)(d+r) bits are divisible by bits are divisible by a generator a generator GG

Homework: read KR sec 5.2Homework: read KR sec 5.2

Page 8: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

8

Point-to-point Data Link ControlPoint-to-point Data Link Control HDLC: high level data link protocol (it's old - data link HDLC: high level data link protocol (it's old - data link

was "high-level" way back when) was "high-level" way back when) HDLC frame format: HDLC frame format:

flag pattern (01111110) is used to mark beginning/end flag pattern (01111110) is used to mark beginning/end of frame of frame

bit stuffing: if five consecutive 1's in data, sender adds a 0, bit stuffing: if five consecutive 1's in data, sender adds a 0, receiver removes receiver removes

address of receiving node (for broadcast links) address of receiving node (for broadcast links)

Page 9: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

9

HDLC: control fieldHDLC: control field

control field format for "data" frames: control field format for "data" frames: 3-bit seq number 3-bit seq number 3-bit ack number 3-bit ack number 1 bit P/F to indicate sender-to-receiver to vice-versa 1 bit P/F to indicate sender-to-receiver to vice-versa

control field format for "supervisory" frames: control field format for "supervisory" frames: command meaning

receive ready ack

receive not ready flow control:not ready

reject NAK: resend go back N

selective reject NAK: resend selective repeat

Page 10: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

10

Broadcast links: Multiple Access Broadcast links: Multiple Access Protocols Protocols

Single shared communication channel Single shared communication channel two or more simultaneous transmissions by two or more simultaneous transmissions by

nodes: nodes: interference interference only one node can send successfully at a only one node can send successfully at a

time time question: how to share this broadcast question: how to share this broadcast

channel examples of multiple access channel examples of multiple access environmentsenvironments: :

Page 11: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

11

ExamplesExamples

Page 12: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

12

Multiple Access ProtocolsMultiple Access Protocols

Distributed algorithm which determines how Distributed algorithm which determines how stations share channel, i.e., determine when stations share channel, i.e., determine when station can transmitstation can transmit

Communication about channel sharing must use Communication about channel sharing must use channel itself! channel itself!

What to look for in multiple access protocols: What to look for in multiple access protocols: synchronous or asynchronous synchronous or asynchronous information needed about other stations information needed about other stations robustness (e.g., to channel errors) robustness (e.g., to channel errors) performance performance

Page 13: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

13

Some Multiple Access ProtocolsSome Multiple Access Protocols

Claim:Claim: humans use multiple access protocols humans use multiple access protocols all the time all the time class can "guess" multiple access protocols class can "guess" multiple access protocols

multiaccess protocol 1:multiaccess protocol 1:

multiaccess protocol 2:multiaccess protocol 2:

multiaccess protocol 3:multiaccess protocol 3:

multiaccess protocol 4:multiaccess protocol 4:

Page 14: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

14

Human MAPsHuman MAPs

Give everyone a chance to speakGive everyone a chance to speak Don’t speak until you are spoken toDon’t speak until you are spoken to Don’t monopolize the conversationDon’t monopolize the conversation Raise your hand if you have a questionRaise your hand if you have a question Don’t interrupt when someone is speakingDon’t interrupt when someone is speaking Don’t fall asleep when someone is talkingDon’t fall asleep when someone is talking

Page 15: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

15

A taxonomy of multiple access A taxonomy of multiple access protocolsprotocols

Random access protocols:Random access protocols: stations contend for stations contend for channel, collisions (overlapping transmissions channel, collisions (overlapping transmissions can occur): can occur):

aloha aloha slotted aloha slotted aloha carrier sense multiple access: Ethernet carrier sense multiple access: Ethernet group random access group random access

Page 16: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

16

Taxonomy of MAPs (cont.)Taxonomy of MAPs (cont.)

Controlled access protocols:Controlled access protocols: stations reserve stations reserve or are assigned channel, no collisions or are assigned channel, no collisions

predetermined channel allocation: time predetermined channel allocation: time division multiple access division multiple access

demand adaptive channel allocation demand adaptive channel allocation reservation protocols reservation protocols token passing (token bus, token ring) token passing (token bus, token ring)

Page 17: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

17

The Aloha ProtocolThe Aloha Protocol

simple:simple: if you have pkt to send, "just do it" if you have pkt to send, "just do it" if pkt suffers collision, will try resending later if pkt suffers collision, will try resending later

Page 18: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

18

Analyzing the Aloha ProtocolAnalyzing the Aloha Protocol

Goal:Goal: quantitative understanding of performance of quantitative understanding of performance of Aloha protocol Aloha protocol

fixed length pkts fixed length pkts pkt transmission time is unit of time pkt transmission time is unit of time throughputthroughput SS - number of pkts successfully (without - number of pkts successfully (without

collision)collision) transmitted per unit time transmitted per unit time in previous example, in previous example, SS = 0.2 pkt/unit time = 0.2 pkt/unit time

Page 19: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

19

offered loadoffered load GG - number pkt transmissions - number pkt transmissions attempted per unit time attempted per unit time note:note: S<GS<G, but , but SS depends on depends on G G Poisson modelPoisson model:: probability of probability of kk pkt transmission pkt transmission

attempts in t time unitsattempts in t time units

Prob[Prob[kk trans in trans in t t ] = ((] = ((GtGt)^)^kk )(e^{- )(e^{-GtGt})/})/kk!!

infinite population modelinfinite population model capacity of multiple access protocolcapacity of multiple access protocol: maximum : maximum

value of value of SS over all values of over all values of GG

Page 20: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

20

Analyzing Aloha (cont)Analyzing Aloha (cont)

Focus on a given attempted packet transmissionFocus on a given attempted packet transmission

SS = = rate attempted pkt trans * Prob[successful trans]rate attempted pkt trans * Prob[successful trans]

= = GG*Prob[no other pkt's overlap with attempted trans] *Prob[no other pkt's overlap with attempted trans]

= = GG*Prob[0 other attempted trans in 2 time units] *Prob[0 other attempted trans in 2 time units]

= = GGe^{-2e^{-2GG}}

Page 21: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

21

Aloha throughputAloha throughput

Note:Note: maximum throughput is 18% of physical channel maximum throughput is 18% of physical channel capacity capacity

you buy 1 Mb link, thoughput will never be more than you buy 1 Mb link, thoughput will never be more than 180Kb! 180Kb!

Page 22: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

22

Slotted AlohaSlotted Aloha

synchronous system: time divided into slots synchronous system: time divided into slots slot size equals fixed packet transmission time slot size equals fixed packet transmission time when pkt ready for transmission, wait until start of when pkt ready for transmission, wait until start of

next slot next slot packets overlap completely or not at all packets overlap completely or not at all

Page 23: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

23

Page 24: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

24

Slotted Aloha performanceSlotted Aloha performance

SS = = GG*Prob[no other transmissions overlap] *Prob[no other transmissions overlap]

= = GG*Prob[0 other attempted transmissions] *Prob[0 other attempted transmissions]

= = GG*Prob[0 other arrivals in previous slot] *Prob[0 other arrivals in previous slot]

= = GGe^{-e^{-GG}}

Page 25: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

25

Carrier Sensing ProtocolsCarrier Sensing Protocols

Aloha is inefficient (and rude!): doesn't listen before Aloha is inefficient (and rude!): doesn't listen before talking! talking!

Carrier Sense Multiple Access: CSMA Carrier Sense Multiple Access: CSMA

non-persistent CSMA:non-persistent CSMA:

1. sense (listen to) channel 1. sense (listen to) channel

2. if {channel sensed busy} 2. if {channel sensed busy}

then wait random time; go to 1 then wait random time; go to 1

else transmit packetelse transmit packet

Page 26: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

26

Carrier Sensing Protocols (cont)Carrier Sensing Protocols (cont)

p-persistent CSMA:p-persistent CSMA:

1. sense (listen to) channel 1. sense (listen to) channel

2. when {channel sensed idle} 2. when {channel sensed idle}

transmit with probability transmit with probability pp

else wait random time, go to 1else wait random time, go to 1

Page 27: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

27

Carrier sensing protocols (cont)Carrier sensing protocols (cont)

channel sensing will not avoid all collisions: channel sensing will not avoid all collisions:

Page 28: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

28

Carrier Sensing (cont.)Carrier Sensing (cont.)

performance will depend on channel length performance will depend on channel length large propagation delays: poor performance large propagation delays: poor performance length of CSMA networks must be limited length of CSMA networks must be limited

Can we do better?Can we do better?

Page 29: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

29

CSMA/CDCSMA/CD

CSMA with collision detection(CD): CSMA with collision detection(CD): listen while talking! listen while talking! stop transmitting when another pkt has collided stop transmitting when another pkt has collided

with your pkt with your pkt

wait random time before attempting to resend wait random time before attempting to resend worst case time to detect a collision? worst case time to detect a collision? performance depends (as in CSMA) on performance depends (as in CSMA) on

channel length channel length

Page 30: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

30

Case Study: EthernetCase Study: Ethernet

CSMA/CD, 1-persistent CSMA/CD, 1-persistent IEEE 802.3 standard IEEE 802.3 standard channel: coaxial cable (typically) channel: coaxial cable (typically) TT: minimum randomization interval : minimum randomization interval

Page 31: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

31

Collision resolution:Collision resolution: binary backoff: pkt arrives (from binary backoff: pkt arrives (from upper layer) for transmission. upper layer) for transmission.

1. 1. Set L=1, mark pkt as "ready" Set L=1, mark pkt as "ready"

2. after successful transmission, all hosts with "ready" 2. after successful transmission, all hosts with "ready" pkt can send pkt can send

3. if {collision} 3. if {collision}

L=L*2, up to 1024 L=L*2, up to 1024

wait random amt of time over next L*T wait random amt of time over next L*T

time units time units

after waiting, pkt is again "ready" after waiting, pkt is again "ready"

go to 2 go to 2

Page 32: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

32

Note:Note: backoff interval dynamically adjusts to load backoff interval dynamically adjusts to load different hosts will have different values of different hosts will have different values of LL light load: small values of light load: small values of LL (typically) (typically) heavy load: larger heavy load: larger LL

Page 33: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

33

Ethernet: exampleEthernet: example

Page 34: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

34

More on ethernetMore on ethernet 10 Mb/sec, 100 Mb/sec standards 10 Mb/sec, 100 Mb/sec standards packet format: packet format:

preamble:preamble: 7 bytes to allow sender/receiver clock synch 7 bytes to allow sender/receiver clock synch start-of-frame:start-of-frame: 1 byte, denotes start of from (like HDLC) 1 byte, denotes start of from (like HDLC) destination address:destination address:

48 bit address "physical address" 48 bit address "physical address" different from IP address!!!! different from IP address!!!! each Ethernet board in world has own unique address hard-wired (IEEE each Ethernet board in world has own unique address hard-wired (IEEE

and vendor assigned) and vendor assigned) dest. address all 1's for broadcast pkt: will be received by all hosts attached dest. address all 1's for broadcast pkt: will be received by all hosts attached

to LAN to LAN

Page 35: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

35

More on ethernetMore on ethernet

source address:source address: 48-bit physical address 48-bit physical address length:length: 2 bytes, max packet length is 1500 2 bytes, max packet length is 1500

bytes bytes data:data: contains packet (e.g., IP packet) contains packet (e.g., IP packet)

handed down from upper layer handed down from upper layer padding:padding: used to insure data plus padding > used to insure data plus padding >

46 bytes 46 bytes checksumchecksum

Page 36: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

36

Group Random Access ProtocolsGroup Random Access Protocols

rather than random backoff to separate rather than random backoff to separate colliding stations, structured "search for colliding stations, structured "search for exactly one station exactly one station

enable group of stations enable group of stations if collisions occur, divide group until only one if collisions occur, divide group until only one

ready station is enabled ready station is enabled tree traversal:tree traversal: think of stations at leaves on think of stations at leaves on

logical binary tree: logical binary tree:

Page 37: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

37

1. all stations rooted at rootnode enabled 1. all stations rooted at rootnode enabled

2. if {no stations send) 2. if {no stations send) return return else if (one station sends) else if (one station sends) return return else /* collision */ else /* collision */ resolve(leftchild(rootnode)) resolve(leftchild(rootnode)) resolve(rightchild(rootnode))resolve(rightchild(rootnode))

Page 38: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

38

Group Random Access: exampleGroup Random Access: example

Page 39: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

39

suppose stations 2,3,7,8 ready with pktsuppose stations 2,3,7,8 ready with pkt

A enabled, collisions A enabled, collisions

B enabled collisions B enabled collisions

D enabled, SUCCESS by 2 D enabled, SUCCESS by 2

E enabled SUCCESS by 3 E enabled SUCCESS by 3

C enabled, collisions C enabled, collisions

F enabled, idle F enabled, idle

G enabled, collisions (could have avoided!) G enabled, collisions (could have avoided!)

7 enabled, SUCCESS 7 enabled, SUCCESS

8 enabled, SUCCESS8 enabled, SUCCESS

Page 40: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

40

Token Passing ProtocolsToken Passing Protocols token circulates among stations token circulates among stations media: media:

token ring connection: IEEE802.5, FDDI token ring connection: IEEE802.5, FDDI token bus, IEEE802.4 token bus, IEEE802.4

to transmit to transmit station must seize token station must seize token transmit packet while holding token transmit packet while holding token release (send out) token release (send out) token

Page 41: 1 The Data Link Layer  introduction  point-to-point data link protocols  the multiple access problem  local area networks  required reading:  Tannenbaum

41