300 likes | 318 Views
This lecture discusses the medium access control (MAC) sublayer protocol in Ethernet networks, specifically focusing on Manchester encoding. It covers topics such as the binary exponential backoff algorithm and the collision detection process.
E N D
EEC-484/584Computer Networks Lecture 13 Wenbing Zhao wenbingz@gmail.com
Outline No class this Wednesday (Thanksgiving Eve) Medium Access Control Ethernet Manchester Encoding The Ethernet MAC Sublayer Protocol The Binary Exponential Backoff Algorithm EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
Frequency Division Multiplexing EEC-484/584: Computer Networks
Time Division Multiplexing T1 Carrier (1.544 Mbps) EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
Multiple Access Protocols ALOHA Carrier Sense Multiple Access Protocols EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
Pure ALOHA: Vulnerable Period Vulnerable period for a frame: A collision will happen if another frame is sent during this period 2 frame time EEC-484/584: Computer Networks
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 = Ge-G Max occurs when G = 1, S = 2*0.184 (G: # of attempts per frame time) EEC-484/584: Computer Networks
Throughput for ALOHA Systems EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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 … EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
Persistent and Nonpersistent CSMA Improves over ALOHA because they ensure no station to transmit when it senses channel is busy EEC-484/584: Computer Networks
CSMA with Collision Detection If two stations start transmitting simultaneously, both detect collision and stop transmitting Minimum time to detect collision? EEC-484/584: Computer Networks
Minimum Time to Detect Collision To ensure the sender can detect collision All frames must take more than 2t to send so that transmission is still taking place when the noise burst gets back to the sender EEC-484/584: Computer Networks
Manchester Encoding Binary encoding Hard to distinguish 0 bit (0-volt) from idle (0-volt) Requires clocks of all stations synchronized Manchester encoding EEC-484/584: Computer Networks
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) Not considered as part of the header! >= 64 bytes EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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 = 2t = worst-case round-trip propagation time To accommodate longest path, slot time = 512 bit times = 51.2 msec (10Mbps Ethernet) => min frame length: 51.2 msec X 10 Mbps = 512 b = 64 byte EEC-484/584: Computer Networks
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 EEC-484/584: Computer Networks
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,…,2m-1}. NIC waits K·512 bit times, returns to Step 2 EEC-484/584: Computer Networks
Randomization and Binary Exponential Backoff After 1st collision, station picks 0 or 1 at random, waits that number of slots and tries again After 2nd 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,…,2i-1 at random, … If 10 <= i < 16, station picks 0,1,…,210-1 at random If i=16, controller reports failure to computer Why randomization is needed? EEC-484/584: Computer Networks
Ethernet Performance Binary exponential backoff results in Low delay when few stations collide Reasonable delay for collision resolution when many stations collide EEC-484/584: Computer Networks
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? EEC-484/584: Computer Networks
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? EEC-484/584: Computer Networks