Communication Networks Lecture 5 NETW 501-L5: NETW 501-L5: Medium Access Control Dr.-Ing. Khaled...

Post on 18-Dec-2015

219 views 0 download

Transcript of Communication Networks Lecture 5 NETW 501-L5: NETW 501-L5: Medium Access Control Dr.-Ing. Khaled...

Communication NetworksLecture 5

NETW 501-L5: Medium Access Control

Dr.-Ing. Khaled Shawky HassanRoom: C3-222, ext: 1204,

Email: khaled.shawky@guc.edu.eg

Data Link Layer

LLC

MAC

Network

Physical

• Framing (Grouping Bits into Frames)

• Error Control

• Flow Control

• Medium Access Control

Multiple Access Communications

• Key issue: How to share the medium?

1

23

4

5M

Shared multipleaccess medium

Multiple-Access Protocols:

EXAMPLE FOR CONTROLLED ACCESS

Ring networks

A Scheduling Method: Token-Passing

token

Station that holds token transmits into ring

tokenData to M

RANDOM ACCESS PROTOCOLS

Multiple-Access Protocols Discussed

1. In random access or contention methods, no station is superior to another station and no one is assigned higher priority over any other station.

2. No station permits, or does not permit, another station to send (every one is free).

3. At each instance, a station that has data to send uses a procedure defined by (WHATEVER) protocol to make a decision on whether or not to send.

ALOHA (slotted and reservation)Carrier Sense Multiple AccessCarrier Sense Multiple Access with Collision DetectionCarrier Sense Multiple Access with Collision Avoidance

Topics discussed so far:

Multitapped Bus

Random Access

Transmit when ready

Crash!!

Transmissions collision can occur; THEREFORE, we need retransmission strategy

Two stations are trying to share a common medium

Two-Station MAC Example

A transmits at t = 0

Distance d meterstprop = d / seconds

A B

A B

B does not transmit beforet = tprop

.'. A captures the channel successfully

Case 1

B transmits before t = tprop and detectscollision .'. A & B transmissions are corrupted

A B

Case 2

A detectscollision at t = 2 tprop A B

ALOHA Operation

• Collision definition:

– Transmissions from two or more terminals overlap in time (this time is called collision region or duration)

• ALOHA Operation:

– Messages transmitted once they are available

– Suddenly, messages may collide (treated as erroneous frames)

– The terminal knows that its messages was corrupted when it receives no acknowledgements within 2tprop + T

t (i.e., a timeout is used)

– Recovery by the use of retransmissions

• Can we simply apply retransmission directly after timeouts?

– NO! Retransmissions will collide again

– SOLUTION: Retransmission after random intervals from timeouts (Backoff Algorithm)

Terminal A

Terminal B

Terminal A

Terminal B

Collision

Terminal A

Terminal B

No CollisionCollision

Collision Region

ALOHA Model• Wireless link to provide data transfer between main campus & remote campuses of

University of Hawaii islands

• Simplest solution: just do it

– A station transmits whenever it has data to transmit

– If more than one frames are transmitted, they interfere with each other (collide) and are lost

– If ACK not received within timeout, then a station picks random backoff time (to avoid repeated collision)

– Station retransmits frame after backoff time

tt0t0-Tt

t0+Tt t0+T

t+2tprop t0+T

t+2tprop+ B

Vulnerableperiod = 2T

t Time-out

Backoff period “B”First transmission

Retransmission

ALOHA Model (Cont.)

• Definitions and assumptions

– Tt frame transmission time (assume constant)

– S: throughput (average # successful frame transmissions per Tt

seconds)

– G: load (average # transmission attempts per Tt sec.)

– Psuccess : probability a frame transmission is successfulS=GP success

TtT

t

frame transmission

Prior interval

Note: Any transmission that begins during vulnerable period leads to collision

Vulnerable time for pure ALOHA protocol

Frames overview in pure ALOHA

Throughput of ALOHA

S=GP success=Ge−2G

0

0.02

0.04

0.06

0.08

0.1

0.12

0.14

0.16

0.18

0.2

G

S

● our analysis assumed that many nodes share a common channel

● if only 1 node uses the medium, S=1

● Max throughput is max=1/2e (18.4%), when G=1/2 ‘one frame per vulnerable period’

● G increases S increases until it reaches S max – after that point the network enters ‘unstable operating conditions’ in which collisions become more likely and the number of backlogged stations increases

1/2e-1 = 0.184

Stable

Unstable

Vulnerable time Example

A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What is the requirement to make this frame collision-free?

SolutionAverage frame transmission time Tfr is 200 bits/200 kbps or 1 ms.

The vulnerable time (from figure) is 2 × 1 ms = 2 ms.

This means that no station should send later than the 1 ms before this station will start its transmission (is it reasonable ??)

And no station should start sending during the one 1-ms period that this station is sending.

Slotted ALOHA● Time is slotted (divided) in T

t = L/R seconds slots

● Stations synchronized to frame times so that each node knows when● the slots begin● Stations transmit frames only at the beginning of slots, and only after

frame is ready● Backoff intervals can be easily multiples of slots

t(k+1)T

tkTt t0 +T

t+2tprop+ B

Vulnerable period= T

t

Time-out

Backoff period B

t0 +Tt+2tprop

Only frames that arrive during prior Tt

seconds collide: Avoid partial collisions

t0

Position depends on

the length of the slot

ALOHA Performance

➢ max throughput of Slotted ALOHA (S max = 0.36) occurs at G=1, which corresponds to a total arrival rate of ‘one frame per vulnerable period’

➢ S max = 0.36 max Slotted ALOHA throughput = 36% of the actual channel ⇒capacity

Slotted ALOHAvs. Pure ALOHA

●slotted ALOHA reduces vulnerability to collision●Higher overall throughput

Vulnerable time for slotted ALOHA protocol

Collision in slotted ALOHA protocol

Throughput for pure/slotted ALOHA protocol

The throughput for pure ALOHA is S = G × e −2G .

The maximum throughputSmax = 18.4% when G (load in frame/msec)= (1/2).

The throughput for pure ALOHA is S = G × e −2G .

The maximum throughputSmax = 18.4% when G (load in frame/msec)= (1/2).

The throughput for slotted ALOHA is S = G × e −G .

The maximum throughputSmax = 36.8% when G (load in frame/msec)= (1).

The throughput for slotted ALOHA is S = G × e −G .

The maximum throughputSmax = 36.8% when G (load in frame/msec)= (1).

Carrier Sensing Multiple Access (CSMA)

A

Station A begins transmission at t = 0

A

Station A captureschannel at t = tprop

• Low throughput of ALOHA is due to waste of bandwidth due to collisions• CSMA:

• Sense (i.e., Listen) the medium for presence of a carrier signal before transmission

• A terminal transmit only if it senses an idle channel• Widely used in LAN with Bus Topology• Vulnerable period = tprop

Network Diameter

Transmitter behavior when busy channel is sensed

– 1-persistent CSMA (most greedy [trial and error])

• Start transmission as soon as the channel becomes idle

• Low delay and low efficiency

– Non-persistent CSMA (least greedy)

• If channel is busy, immediately run the backoff algorithm to set a time to re-sense the channel

• High delay and high efficiency

– p-persistent CSMA (adjustable/adaptive greedy)

• If the channel is busy, wait till channel becomes idle, transmit with prob. p; or wait one mini-slot time & re-sense with probability 1-p

• Delay and efficiency can be balanced

CSMA Options

CSMA of three persistence methods

CSMA with Collision Detection (CSMA/CD)

• ‘collision detection’ is another level of CSMA

• CSMA-CD reduces wastage to time to detect collision and abort transmission

• in CSMA/CD

– station listens while transmitting

– if a station hears something different than what it is sending, it immediately stops (this happens when 2 or more transmitting signals garble each other)

– in addition, if a collision is detected, a short jamming signal is subsequently sent to ensure that other stations know that collision has occurred (thus, all stations discard the part of frame received)

– reschedule random backoff times, and try again at scheduled times

CSMA/CD reaction time

It takes 2* tprop to find out if channel has been captured

Note 1: This is called “reaction time”Note 2: collision detection works only as long as frame-sizeis sufficiently long to require more than a round-trip timefor transmission

A begins to transmit at t = 0

A B

B begins to transmit at t = tprop- ;

B detectscollision at t = tprop

A B

A B

A detectscollision at t= 2 tprop-

frame size/R (Tt) > 2 * tprob

Analysis of p-persistent CSMA/CD

• channel can be in three states:

– busy transmitting / idle / contention period

• Def: contention period – stations attempt to capture the channel by transmitting during mini-slots and listening whether they have successfully captured the channel or not

each contention interval (minislot) = 2*tprop

Busy Contention Busy

Time

Idle Contention Busy

• Assume n stations contend for the channel, each station transmits during a contention mini-slot with probability p.

Vulnerable time in CSMA

Space/time model of the collision in CSMA

Contention Resolution Performance

• For small a: CSMA-CD has best throughput• For larger a: Aloha & slotted Aloha better throughput

Tprop/Tt =a

Collision of the first bit in CSMA/CD

Collision and abortion in CSMA/CD

CSMA/CD Example

A network using CSMA/CD has a bandwidth of 10 Mbps. If the maximum propagation time (including the delays in the devices and ignoring the time needed to send a jamming signal) is 25.6 μs, In this case, what is the minimum size of the frame?

SolutionThe frame transmission time is Tfr = 2 × Tp = 51.2 μs. This means, in the worst case, a station needs to transmit for a period of 51.2 μs to detect the collision.

The minimum size of the frame is: 10 Mbps × 51.2 μs = 512 bits or 64 bytes.

This is actually the minimum size of the frame for Standard Ethernet.

Energy level during transmission, idleness, or collision