Docsity

Lecture Notes: CMSC 417 - F01 (Lecture 5) - Data Link Protocols and Pthreads - Prof. Jeffr, Study notes of Computer Systems Networking and Telecommunications

Partial preview of the text

Download Lecture Notes: CMSC 417 - F01 (Lecture 5) - Data Link Protocols and Pthreads - Prof. Jeffr and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

  • F01 (lect 5)

copyright 2001 Jeffrey K. Hollingsworth

Announcements

l^

Enrollment^ – No one is left on the wait list

l^

Reading^ – Today: Chapter 5 (5.1-5.2)

l^

Project #2^ – Handout is on the web– Due on Wed Sept 26

th^ (10 AM)

– Reminder, not credit for late work

  • F01 (lect 5)

copyright 2001 Jeffrey K. Hollingsworth

ATM Datalink Protocol

l^

Cells (53 bytes)^ –^

5 byte header (4 bytes address plus 1 byte crc)

–^

48 byte payload

l^

Header^ –^

use CRC over the 32 bits of the header

l^

How to find cell boundary?^ –^

use shift register to check for valid checksum•^

1/256 chance of a random match

–^

use HUNT mode to increase chances•^

after a good cell, skip to the next cell boundary• must receive

δ^ cells with checksum matches

l^

Detecting loss of synchronization^ –^

one bad cell is probably an error

–^

many bad cells is likely a slip (loss of sync)

–^

if^ α

bad cells are seen in a row, switch to hunt mode

  • F01 (lect 5)

copyright 2001 Jeffrey K. Hollingsworth

Sliding Window Protocol

l^

Need to^ – have multiple outstanding packets– limit total number of outstanding packets– permit re-transmissions to occur

l^

Sliding Window^ – permit at most N outstanding packets– when packet is ACK’d advance window to first non-ACK’d pkt

l^

Retransmission^ – Go-back N

• when a packet is lost, restart from that packet• provides in-order delivery, but wastes bandwidth

– Selective Retransmission

• use timeout to re-sent lost packet• use NACK as a

hint

that something was lost

  • F01 (lect 5)

copyright 2001 Jeffrey K. Hollingsworth

Sliding Window Example

Go-back N vs. Selective Retransmission

From:

Computer Networks, 3

rd^ Ed. by Andrew S. Tanenbaum, (c)1996 Prentice Hall.

E^

D^

D^

D^

D^

D^

D

Timeout interval Error

Frames discarded by data link layer Ack 0

Ack 1

Ack 2

Ack 3

Ack 4

Ack 5

Ack 6 Ack 7

E^

Timeout interval Error

Buffered by data link layer

Packets 2-8 passedto network layer

Ack 0

Ack 1

Ack 1

Ack 1

Ack 1

Ack 1

Ack 1 Ack 1

Ack 8

Ack 9

Ack 10

Time

(a) (b)

  • F01 (lect 5)

copyright 2001 Jeffrey K. Hollingsworth

Using Locks for the Critical Section

l^

Lock:^ – if no thread has the lock mark it locked and return– if another thread has the lock, wait

l^

Unlock:^ – release the lock– if other threads waiting, notify one

or

all of them

l^

Called mutexs in pthreads^ – pthread_mutex is the data type– pthread_mutex_init used to initialize it– pthread_mutex_lock locks it– pthread_mutex_unlock releases it

l^

Lock Grainularity^ – want to lock enough to protect accesses– don’t want to lock too much to slow down the program