Download presentation
Presentation is loading. Please wait.
1
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao wenbingz@gmail.com
2
2 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Outline Medium Access Control Ethernet –Manchester Encoding –The Ethernet MAC Sublayer Protocol –The Binary Exponential Backoff Algorithm
3
3 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Medium Access Control Sublayer Broadcast channels often used on data link layer –Broadcast channels often referred to as multiaccess or random access channels The channel allocation problem: Who gets to use the channel? –Static Channel Allocation –Dynamic Channel Allocation
4
4 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Static Channel Allocation FDM – Frequency Division Multiplexing –Frequency spectrum divided into logical channel –Each user has exclusive use of own frequency band TDM – Time Division Multiplexing –Time divided into slots each user has time slot –Users take turns in round robin fashion Problem: wasted bandwidth if user does not use his/her frequency band or timeslot
5
5 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Frequency Division Multiplexing
6
6 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Time Division Multiplexing T1 Carrier (1.544 Mbps)
7
7 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Model for Dynamic Channel Allocation N independent stations (also called terminals) Once a frame has been generated, the station is blocked until the frame is transmitted successfully Single Channel shared by all stations Collision – event when two frames transmitted simultaneously and the resulting signal is garbled –All stations can detect collisions
8
8 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Model for Dynamic Channel Allocation Frame transmission time –Continuous Time – can begin at any instant –Slotted Time – always begin at the start of a slot Carrier sense or not –Carrier sense – stations can tell if the channel is busy. Do not send if channel is busy –No carrier sense – just go ahead and send
9
9 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Multiple Access Protocols ALOHA Carrier Sense Multiple Access Protocols
10
10 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Pure ALOHA Let users transmit whenever they have data to send If frame destroyed (due to collision), sender waits random amount of time, sends again User does not listen before transmitting
11
11 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Pure ALOHA: Vulnerable Period Vulnerable period for a frame: A collision will happen if another frame is sent during this period 2 frame time
12
12 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Slotted ALOHA Idea: divide time into intervals, each interval corresponds to one frame –Station is permitted to send only at the beginning of next slot Vulnerable period is halved (1 frame time) –Probability of no collision in time slot = e -G –Throughput S = G e -G –Max occurs when G = 1, S = 2*0.184 (G: # of attempts per frame time)
13
13 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Throughput for ALOHA Systems
14
14 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Carrier Sense Multiple Access When station has data to send, listens to channel to see if anyone else is transmitting If channel is idle, station transmits a frame –Else station waits for it to become idle If collisions occurs, station waits random amount of time, tries again Also called 1-persistent CSMA –With probability 1 station will transmit if channel is idle
15
15 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao After a station starts sending, it takes a while before 2nd station receives 1st station ’ s signal –2nd station might start sending before it knows that another station has already been transmitting If two stations become ready while third station transmitting –Both wait until transmission ends and start transmitting, collision results Carrier Sense Multiple Access: Collision Still Possible
16
16 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao p-persistent CSMA: Reduce the Probability of Collision Sense continuously, but does not always send when channel is idle –Applicable for slotted channels When ready to send, station senses the channel –If channel idle, station transmits with probability p, defers to next slot with probability q = 1-p –Else (if channel is busy) station waits until next slot tries again –If next slot idle, station transmits with probability p, defers with probability q = 1-p –…–…
17
17 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Non-Persistent CSMA Does not sense continuously, send if it senses the channel is idle Before sending, station senses the channel –If channel is idle, station begins sending –Else station does not continuously sense, waits random amount of time, tries again
18
18 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Persistent and Nonpersistent CSMA Improves over ALOHA because they ensure no station to transmit when it senses channel is busy
19
19 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao CSMA with Collision Detection If two stations start transmitting simultaneously, both detect collision and stop transmitting Minimum time to detect collision?
20
20 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Minimum Time to Detect Collision To ensure the sender can detect collision –All frames must take more than 2 to send so that transmission is still taking place when the noise burst gets back to the sender
21
21 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Manchester Encoding Binary encoding –Hard to distinguish 0 bit (0-volt) from idle (0-volt) –Requires clocks of all stations synchronized Manchester encoding and differential Manchester encoding
22
22 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Ethernet Frame Structure Preamble: for clock synchronization –First 7 bytes with pattern 10101010, last byte with pattern 10101011 –The two consecutive 1 ’ s indicate the start of a frame How can the receiver tell the end of the frame? –No current on the wire ( interesting discussion at http://www.tomshardware.com/forum/19951-42-detecting-length-ethernet-frame) http://www.tomshardware.com/forum/19951-42-detecting-length-ethernet-frame >= 64 bytes Not considered as part of the header!
23
23 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Ethernet Frame Structure Destination address: 6 bytes (48 bits) –Highest order bit: 0 individual, 1 multicast; all 1 ’ s broadcast –Frames received with non-matching destination address is discarded Type/Length: type of network layer protocol (or length of payload) Pad – used to produce valid frame >= 64 bytes Checksum – 32-bit cyclic redundancy check
24
24 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao CSMA with Collision Detection If two stations start transmitting simultaneously, both detect collision and stop transmitting Monitor collision while sending –Minimum time to detect collision => minimum frame length Time divided into slots –Length of slot = 2 = worst-case round-trip propagation time –To accommodate longest path, slot time = 512 bit times = 51.2 sec (10Mbps Ethernet) => min frame length: 51.2 sec X 10 Mbps = 512 b = 64 byte
25
25 EEC-484/584: Computer Networks5-25 Ethernet MAC Sublayer Protocol Connectionless: No handshaking between sending and receiving NICs –Ethernet resides in the Network Interface Card (NIC) Unreliable: receiving NIC doesn’t send acks or nacks to sending NIC –stream of datagrams passed to network layer can have gaps (missing datagrams) –gaps will be filled if app is using TCP –otherwise, app will see gaps Ethernet’s MAC protocol: CSMA/CD 6/27/2015
26
26 EEC-484/584: Computer Networks5-26 Ethernet CSMA/CD algorithm 1. NIC receives datagram from network layer, creates frame 2. If NIC senses channel idle, starts frame transmission If NIC senses channel busy, waits until channel idle, then transmits 3. If NIC transmits entire frame without detecting another transmission, NIC is done with frame ! 4. If NIC detects another transmission while transmitting, aborts and sends jam signal 5. After aborting, NIC enters exponential backoff: after mth collision, NIC chooses K at random from {0,1,2,…,2 m -1}. NIC waits K·512 bit times, returns to Step 2 6/27/2015
27
27 EEC-484/584: Computer NetworksWenbing Zhao Randomization and Binary Exponential Backoff After 1 st collision, station picks 0 or 1 at random, waits that number of slots and tries again After 2 nd collision, station picks 0,1,2,3 at random, waits that number of slots and tries again …. After i-th collision, station picks 0,1, …,2 i -1 at random, … If 10 <= i < 16, station picks 0,1, …,2 10 -1 at random If i=16, controller reports failure to computer Why randomization is needed?
28
28 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Ethernet Performance Binary exponential backoff results in –Low delay when few stations collide –Reasonable delay for collision resolution when many stations collide
29
29 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Exercise An IP packet to be transmitted by Ethernet is 60 bytes long. Is padding needed in the Ethernet frame, and if so, how many bytes?
30
30 6/27/2015EEC-484/584: Computer NetworksWenbing Zhao Exercise Consider building a CSMA/CD network running at 1 Gbps over a 1-km cable. The signal speed in the cable is 200,000 km/sec. What is the minimum frame size?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.