cmpe 80n spring 2003 week 4

41
1 CMPE 80N - Introduction to Networks and the Internet CMPE 80N Spring 2003 Week 4 Introduction to Networks and the Internet

Upload: renee

Post on 22-Jan-2016

42 views

Category:

Documents


0 download

DESCRIPTION

CMPE 80N Spring 2003 Week 4. Introduction to Networks and the Internet. Announcements. HTML tutorial on 04.29 (in class). Links to on-line HTML tutorials/tools. Layer 2: Data Link Layer. Data Link Layer. So far, sending signals over transmission medium. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CMPE 80N Spring 2003 Week 4

1CMPE 80N - Introduction to Networks and the Internet

CMPE 80N

Spring 2003

Week 4

Introduction to Networks and the Internet

Page 2: CMPE 80N Spring 2003 Week 4

2CMPE 80N - Introduction to Networks and the Internet

Announcements

• HTML tutorial on 04.29 (in class).– Links to on-line HTML tutorials/tools.

Page 3: CMPE 80N Spring 2003 Week 4

3CMPE 80N - Introduction to Networks and the Internet

Layer 2: Data Link Layer

Page 4: CMPE 80N Spring 2003 Week 4

4CMPE 80N - Introduction to Networks and the Internet

Data Link Layer

• So far, sending signals over transmission medium.

• Data link layer: responsible for error-free (reliable) communication between adjacent nodes.

• Functions: framing, error control, flow control, addressing, and medium access (in shared networks).

Page 5: CMPE 80N Spring 2003 Week 4

5CMPE 80N - Introduction to Networks and the Internet

medium access control

logical link control

Medium Access Control Protocols

Coordinate competing requests

for medium.

PHYSICAL

LINK

NETWORK

TRANSPORT

SESSION

PRESENTATION

APPLICATION

Sharing of link and transportof data over the link

Page 6: CMPE 80N Spring 2003 Week 4

6CMPE 80N - Introduction to Networks and the Internet

Medium Access Control

• Problem: – Computers in a shared network environment.– Only one computer can transmit at a time.

• If two computers try to use the same line at the same time, their messages get garbled.

• Collision!

– How can we organize the transmission so that all computers are given an opportunity to exchange messages?

Page 7: CMPE 80N Spring 2003 Week 4

7CMPE 80N - Introduction to Networks and the Internet

Medium Access Control

• Control access to shared medium.• How?

Page 8: CMPE 80N Spring 2003 Week 4

8CMPE 80N - Introduction to Networks and the Internet

The Multiplexing Problem

Analogy: a highway shared by many userstime

frequency

Shared channel

(how to divide resource among multiple recipients?)

Page 9: CMPE 80N Spring 2003 Week 4

9CMPE 80N - Introduction to Networks and the Internet

Frequency-Division Multiplexing

Analogy: a highway has multiple lanestime

frequency

user 1

user 2

user 3user 4

guard-band

Page 10: CMPE 80N Spring 2003 Week 4

10CMPE 80N - Introduction to Networks and the Internet

Time-Division Multiplexing

Requirement: precise time coordinationtime

frequency

user 1 user 2 user 3 user 4

guard-band

user 1 user 2

Page 11: CMPE 80N Spring 2003 Week 4

11CMPE 80N - Introduction to Networks and the Internet

Frequency-Time-Division

time

frequency

time-slot (usually of the same size)

Page 12: CMPE 80N Spring 2003 Week 4

12CMPE 80N - Introduction to Networks and the Internet

Centralized versus Distributed MAC

• Centralized approaches:– Controller grants access to medium.– Simple, greater control: priorities, qos.– But, single point of failure and performance

bottleneck.

• Decentralized schemes:– All stations collectively run MAC to decide when

to transmit.

Page 13: CMPE 80N Spring 2003 Week 4

13CMPE 80N - Introduction to Networks and the Internet

Round-Robin MAC

• Each station is allowed to transmit; station may decline or transmit (bounded by some maximum transmit time).

• Centralized (e.g., polling) or distributed (e.g., token ring) control of who is next to transmit.

• When done, station relinquishes and right to transmit goes to next station.

• Efficient when many stations have data to transmit over extended period (stream).

Page 14: CMPE 80N Spring 2003 Week 4

14CMPE 80N - Introduction to Networks and the Internet

Scheduled Access MAC

• Time divided into slots.• Station reserves slots in the future.• Multiple slots for extended transmissions.• Suited to stream traffic.

Page 15: CMPE 80N Spring 2003 Week 4

15CMPE 80N - Introduction to Networks and the Internet

Contention-Based MAC

• No control.• Stations try to acquire the medium.• Distributed in nature.• Perform well for bursty traffic.• Can get very inefficient under heavy load.

• NOTE: round-robin and contention are the most common.

Page 16: CMPE 80N Spring 2003 Week 4

16CMPE 80N - Introduction to Networks and the Internet

MAC Protocols

• Contention-based– ALOHA and Slotted ALOHA.

– CSMA.

– CSMA/CD.

• Round-robin : token-based protocols.– Token bus.

– Token ring.

Page 17: CMPE 80N Spring 2003 Week 4

17CMPE 80N - Introduction to Networks and the Internet

Standardized MACsTopologies

Bus Ring

Round robin

Scheduled

Contention

Token bus(802.4)Polling (802.11)

DQDB(802.6)

CSMA/CD(802.3)CSMA/CA(802.11)

Token ring(802.5; FDDI)

Techniques

Page 18: CMPE 80N Spring 2003 Week 4

18CMPE 80N - Introduction to Networks and the Internet

Contention-Based MACs

Page 19: CMPE 80N Spring 2003 Week 4

19CMPE 80N - Introduction to Networks and the Internet

The ALOHA Protocol

• Developed @ U of Hawaii in early 70’s.• Packet radio networks.• “Free for all”: whenever station has a frame to

send, it does so.– Station listens for maximum RTT for an ACK.– If no ACK, re-sends frame for a number of times

and then gives up.– Receivers check FCS and destination address to

ACK.

Page 20: CMPE 80N Spring 2003 Week 4

20CMPE 80N - Introduction to Networks and the Internet

Collisions

• Invalid frames may be caused by channel noise or

• Because other station(s) transmitted at the same time: collision.

• Collision happens even when the last bit of a frame overlaps with the first bit of the next frame.

Page 21: CMPE 80N Spring 2003 Week 4

21CMPE 80N - Introduction to Networks and the Internet

ALOHA’s Performance 1

Timet0

t0+t t0+2t t0+3t

vulnerable

Page 22: CMPE 80N Spring 2003 Week 4

22CMPE 80N - Introduction to Networks and the Internet

ALOHA’s Performance 2

• S = G e-2G, where S is the throughput (rate of successful transmissions) and G is the offered load.

• S = Smax = 1/2e = 0.184 for G=0.5.

Page 23: CMPE 80N Spring 2003 Week 4

23CMPE 80N - Introduction to Networks and the Internet

Slotted Aloha

• Doubles performance of ALOHA.• Frames can only be transmitted at beginning

of slot: “discrete” ALOHA.• Vulnerable period is halved.• S = G e-G.

• S = Smax = 1/e = 0.368 for G = 1.

Page 24: CMPE 80N Spring 2003 Week 4

24CMPE 80N - Introduction to Networks and the Internet

ALOHA Protocols

• Poor utilization.• Key property of LANs: propagation delay

between stations is small compared to frame transmission time.

• Consequence: stations can sense the medium before transmitting.

Page 25: CMPE 80N Spring 2003 Week 4

25CMPE 80N - Introduction to Networks and the Internet

Carrier-Sense Multiple Access (CSMA)

• Station that wants to transmit first listens to check if another transmission is in progress (carrier sense).

• If medium is in use, station waits; else, it transmits.

• Collisions can still occur.• Transmitter waits for acknowledgement

(ACK); if no ACKs, retransmits.

Page 26: CMPE 80N Spring 2003 Week 4

26CMPE 80N - Introduction to Networks and the Internet

CSMA/CD 1

• CSMA with collision detection.• Problem: when frames collide, medium is

unusable for duration of both (damaged) frames.

• For long frames (when compared to propagation time), considerable waste.

• What if station listens while transmitting?

Page 27: CMPE 80N Spring 2003 Week 4

27CMPE 80N - Introduction to Networks and the Internet

CSMA/CD Protocol

1. If medium idle, transmit; otherwise 2.

2. If medium busy, wait until idle, then transmit.

3. If collision detected, abort transmission.

4. After aborting, wait random time, try again.

Page 28: CMPE 80N Spring 2003 Week 4

28CMPE 80N - Introduction to Networks and the Internet

Ethernet

Page 29: CMPE 80N Spring 2003 Week 4

29CMPE 80N - Introduction to Networks and the Internet

Ethernet • Most popular CSMA/CD protocol.• What if a computer transmits a very long

message?– It keeps the line busy for very long time, while

all other computers in the LAN must wait for the long message to end

• Rule #1 of resource sharing: All “messages” must be “small”, to allow other computers to access the line– For Ethernet, the maximum size of the

payload is 1,500 bytes

Page 30: CMPE 80N Spring 2003 Week 4

30CMPE 80N - Introduction to Networks and the Internet

Ethernet (cont’d)• What is expected performance?

– When only one computer needs to transmit: it can immediately access the line.

– When many computers want access (high traffic):

• Average waiting time is high.• There is high probability of “collision”.

– For every collision, Xmission must start agan

– Fairness?.• Conclusion: expected delay depends on the

traffic on the LAN!

Page 31: CMPE 80N Spring 2003 Week 4

31CMPE 80N - Introduction to Networks and the Internet

Ethernet Frame Format

Preamble DA SA Type Data CRC Postamble

Type: identifies upper layer protocol (for demux’ing)Data: 0-1500 bytes (min. is 46 bytes).DA and SA: destination and source addresses.

8 6 6 2 4 1

Page 32: CMPE 80N Spring 2003 Week 4

32CMPE 80N - Introduction to Networks and the Internet

Round-Robin MACs

• Polling.• Token passing.

Page 33: CMPE 80N Spring 2003 Week 4

33CMPE 80N - Introduction to Networks and the Internet

Token Passing

• Consider the following game: – A group of friends sitting in a circle– A ball is passed from friend to friend

• When somebody receives the ball, it passes to the friend to his/her left

– A person is allowed to talk only when s/he has the ball in his/her hands

• This guarantees that only one person talks at a time!

Page 34: CMPE 80N Spring 2003 Week 4

34CMPE 80N - Introduction to Networks and the Internet

Token Passing (cont’d)

• Let’s make the game more difficult:– A person that receives the ball and has something to

say, rather than saying it, s/he writes it on a letter• Including the name of the addressee

– Before passing along the ball, s/he passes along the letter

– Everyone who receives the paper passes it to the person to his/her left

• If s/he is the recipient of the letter, s/he signs it after reading it

– Once the letter arrives back to the sender, s/he throws it away

• The ball is still circulating in the circle

Page 35: CMPE 80N Spring 2003 Week 4

35CMPE 80N - Introduction to Networks and the Internet

Token Ring

• A Token Ring MAC works similarly:– A special pattern (3-bytes word) of bits called token

moves from one computer to the next.

– If a computer does not have a message to send, it just passes the token along.

– Otherwise, it “seizes the token” and transmits its message (including the address) instead.

– The message is passed from one computer to the next, until it arrives back to the sender, which “destroys” it (does not pass it along anymore).

– The addressee may “write” something on the message so that the sender knows it has been received correctly.

– Once the computer is done transmitting the message, it “releases” (transmits) the token.

Page 36: CMPE 80N Spring 2003 Week 4

36CMPE 80N - Introduction to Networks and the Internet

Token Ring (cont’d)

• When station wants to transmit:– Waits for token.

– Seizes it.

– Transmits frame.

• When station seizes token and begins transmission, there’s no token on the ring; so nobody else can transmit.

Page 37: CMPE 80N Spring 2003 Week 4

37CMPE 80N - Introduction to Networks and the Internet

Token Ring (cont’d)• What is expected performance of Token

Passing?– It is fair.

• Each computer is given in turn an opportunity to transmit, even when the traffic is high.

– However, even if only one computer needs to transmit a message, it has to wait that it receives the token.

• Again, long messages should not be allowed, because otherwise one computer may “hold the token” for too long.

Page 38: CMPE 80N Spring 2003 Week 4

38CMPE 80N - Introduction to Networks and the Internet

Token Ring Frame Format

1SD AC FC DA SA Data FCS

1 1 2 or 6 2 or 6 4

SD: starting delimiter; indicates starting of frame.AC: access control; PPPTMRRR; PPP and RRR priority and reservation; M monitor bit; T token or data frame.FC: frame control; if LLC data or control.DA and SA: destination and source addresses.FCS: frame check sequence.

SD AC FC Token frame

ED: ending delimiter; contains the error detection bit E; containsframe continuation bit I (multiple frame transmissions).FS: frame status.

1 1

ED FS

Page 39: CMPE 80N Spring 2003 Week 4

39CMPE 80N - Introduction to Networks and the Internet

Ethernet versus Token Ring

• Token ring:– Efficient at heavy traffic.

– Guaranteed delay.

– Fair.

– But, ring/token maintenance overhead.

– But, under light traffic?

• Ethernet is simple!

Page 40: CMPE 80N Spring 2003 Week 4

40CMPE 80N - Introduction to Networks and the Internet

Wireless LANs

• IEEE 802.11.• Distributed access control mechanism (DCF)

based on CSMA with optional centralized control (PCF).

Physical Layer

DCF

PCFMAClayer

Contention-freeService (polling)

ContentionService(CSMA)

Page 41: CMPE 80N Spring 2003 Week 4

41CMPE 80N - Introduction to Networks and the Internet

MAC in Wireless LANs

• Distributed coordination function (DCF) uses CSMA-based protocol (e.g., ad hoc networks).

• CD does not make sense in wireless.– Hard for transmitter to distinguish its own

transmission from incoming weak signals and noise.

• Point coordination function (PCF) uses polling to grant stations their turn to transmit (e.g., cellular networks).