CIS 725 Data Link Layer Physical Layer Figure

  • Slides: 38
Download presentation
CIS 725 Data Link Layer

CIS 725 Data Link Layer

Physical Layer

Physical Layer

Figure 3 -1 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -1 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -2 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -2 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -3 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -3 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -5

Figure 3 -5

Figure 3 -7 B. Forouzan, TCP/IP Protocol Suite

Figure 3 -7 B. Forouzan, TCP/IP Protocol Suite

Data Link Layer • Physical layer provides unreliable bit stream • Services provided by

Data Link Layer • Physical layer provides unreliable bit stream • Services provided by DLL: - framing - message corruption - message reordering - message duplication - message insertion

Functions of the Data Link Layer Relationship between packets and frames.

Functions of the Data Link Layer Relationship between packets and frames.

Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.

Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.

Services Provided to Network Layer Placement of the data link protocol.

Services Provided to Network Layer Placement of the data link protocol.

 • Unacknowledged connectionless service • Acknowledged connection oriented service

• Unacknowledged connectionless service • Acknowledged connection oriented service

Framing • Converting a stream to frames (1) bit-oriented (2) character-oriented

Framing • Converting a stream to frames (1) bit-oriented (2) character-oriented

Framing Bit stuffing (a) The original data. (b) The data as they appear on

Framing Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing.

Framing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences

Framing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.

Corruption • Error detection • Error correction - forward error control - feedback error

Corruption • Error detection • Error correction - forward error control - feedback error control

Error codes • Parity bit • Block codes • Hamming distance

Error codes • Parity bit • Block codes • Hamming distance

Data transmission protocol S: do avail(nl_buff) sbuff = nl_buff; deliver sbuff to PL; od

Data transmission protocol S: do avail(nl_buff) sbuff = nl_buff; deliver sbuff to PL; od R: do avail(pl_buff) rbuff = pl_buff; deliver rbuff to NL od

S: do avail(nl_buff) sbuff = nl_buff; R ! sbuff od R: do S ?

S: do avail(nl_buff) sbuff = nl_buff; R ! sbuff od R: do S ? rbuff deliver rbuff to NL od

Error detection protocol S: sent = false do !sent / avail(nl_buff) sbuff = nl_buff;

Error detection protocol S: sent = false do !sent / avail(nl_buff) sbuff = nl_buff; R ! Sbuff; sent = true [] R ? ack sent = false [] R ? nack R ! sbuff od

Error detection protocol R: do S ? rbuff if error(rbuff) then S ! nack

Error detection protocol R: do S ? rbuff if error(rbuff) then S ! nack else deliver(rbuff); S ! ack od

Reordering • Detection of reordering • Correction

Reordering • Detection of reordering • Correction

Reordering: sender • S: ns = 1; do avail(nl_buff[ns]) sbuff[ns] = nl_buff[ns]; R !

Reordering: sender • S: ns = 1; do avail(nl_buff[ns]) sbuff[ns] = nl_buff[ns]; R ! (sbuff[ns], ns); ns++ od

Reordering: receiver • R: nr = 1; do S ? (D, x) rbuff[x] =

Reordering: receiver • R: nr = 1; do S ? (D, x) rbuff[x] = D; Recd[x] = true [] Recd[nr] deliver(rbuff[nr]); nr++ od

Message Loss • Detection of message loss - timeout non-premature timeout: if a timeout

Message Loss • Detection of message loss - timeout non-premature timeout: if a timeout occurs then message is indeed lost premature timeout: if a timeout occurs then a message might have been lost

Alternating Bit Protocol - Premature timeouts Message Loss detection • S: sbit = 0;

Alternating Bit Protocol - Premature timeouts Message Loss detection • S: sbit = 0; sent = false do !sent / avail(nl_buff) sbuff = nl_buff; R ! (sbuff, sbit); sent = true [] timeout R ! (sbuff, sbit) [] R ? (ack, b) if b = sbit then sent = false; sbit = !sbit od

 • R: rbit = 0; do S ? (rbuff, b) if (b =

• R: rbit = 0; do S ? (rbuff, b) if (b = rbit) then deliver(rbuff); rbit = ! rbit; S ! (ack, b) od

rbit 0 d, 0 0 a, 0 1 a, 0 d, 0 a, 0

rbit 0 d, 0 0 a, 0 1 a, 0 d, 0 a, 0 sbit 0 d, 0 a, 0 d, 0 0 1 a, 0 d, 1

 • R: rbit = 0; do S ? (rbuff, b) if (b =

• R: rbit = 0; do S ? (rbuff, b) if (b = rbit) then deliver(rbuff); rbit = ! rbit; S ! (ack, b) od

Alternating Bit Protocol - Premature timeouts Message Loss detection • S: sbit = 0;

Alternating Bit Protocol - Premature timeouts Message Loss detection • S: sbit = 0; sent = false ; start timer do !sent / avail(nl_buff) sbuff = nl_buff; R ! (sbuff, sbit); sent = true ; start timer [] timeout R ! (sbuff, sbit) ; start timer [] R ? (ack, b) if b = sbit then sent = false; sbit = !sbit ; cancel timer od

d, 0 sbit 0 d, 0 a, 0 d, 1 a, 1 d, 0

d, 0 sbit 0 d, 0 a, 0 d, 1 a, 1 d, 0 a, 0 1 1 d, 1 a, 1 d, 0 FIFO channels

ABP with non-premature timeouts 0 4 -d 0; ST timeout +d 0 1 +a

ABP with non-premature timeouts 0 4 -d 0; ST timeout +d 0 1 +a 1 5 +a 0 -a 1 2 timeout +d 0 -a 0 6 -d 1; ST 3 +d 1 7 +d 1

0 +a 1 Premature Timeouts 4 -d 0; ST timeout +d 0 +a 1

0 +a 1 Premature Timeouts 4 -d 0; ST timeout +d 0 +a 1 1 +a 0 +a 1 +d 0 +a 0 2 timeout -a 1 -a 0 +d 1 6 -d 1; ST 3 +d 0 5 +d 1 +a 0 7 +d 1