Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao [email protected] Outline No class this Wednesday (Thanksgiving Eve) Medium Access Control Ethernet Manchester Encoding The Ethernet MAC Sublayer Protocol The Binary Exponential Backoff Algorithm 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Static Channel Allocation FDM – Frequency Division Multiplexing TDM – Time Division Multiplexing Frequency spectrum divided into logical channel Each user has exclusive use of own frequency band 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/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Frequency Division Multiplexing 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Time Division Multiplexing T1 Carrier (1.544 Mbps) 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 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 Wenbing Zhao Multiple Access Protocols ALOHA Carrier Sense Multiple Access Protocols 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing 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) 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Throughput for ALOHA Systems 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Carrier Sense Multiple Access: Collision Still Possible 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 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 … 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Persistent and Nonpersistent CSMA Improves over ALOHA because they ensure no station to transmit when it senses channel is busy 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao CSMA with Collision Detection If two stations start transmitting simultaneously, both detect collision and stop transmitting Minimum time to detect collision? 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao 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 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Manchester Encoding Binary encoding Hard to distinguish 0 bit (0-volt) from idle (0-volt) Requires clocks of all stations synchronized Manchester encoding 5/25/2017 EEC-484/584: Computer Networks Wenbing 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) Not considered as part of the header! 5/25/2017 >= 64 bytes EEC-484/584: Computer Networks Wenbing 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 5/25/2017 EEC-484/584: Computer Networks Wenbing 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 5/25/2017 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 Wenbing Zhao 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 5/25/2017 EEC-484/584: Computer Networks 5-25 Ethernet CSMA/CD algorithm 1. NIC receives datagram from 4. If NIC detects another network layer, creates frame transmission while transmitting, aborts and sends 2. If NIC senses channel idle, jam signal starts frame transmission If NIC senses channel busy, 5. After aborting, NIC enters waits until channel idle, then exponential backoff: after transmits mth collision, NIC chooses K at random from 3. If NIC transmits entire frame {0,1,2,…,2m-1}. NIC waits K·512 without detecting another bit times, returns to Step 2 transmission, NIC is done with frame ! 5/25/2017 EEC-484/584: Computer Networks 5-26 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? 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao Ethernet Performance Binary exponential backoff results in Low delay when few stations collide Reasonable delay for collision resolution when many stations collide 5/25/2017 EEC-484/584: Computer Networks Wenbing 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? 5/25/2017 EEC-484/584: Computer Networks Wenbing 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? 5/25/2017 EEC-484/584: Computer Networks Wenbing Zhao