Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao

Similar presentations


Presentation on theme: "EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao"— Presentation transcript:

1 EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao wenbingz@gmail.com

2 7/12/2015 EEC-484/584: Computer Networks Wenbing Zhao Outline CRC Medium Access Control (MAC) Ethernet  Manchester Encoding  The Ethernet MAC Sublayer Protocol  The Binary Exponential Backoff Algorithm

3 7/12/2015 EEC484/584: Computer Networks 3 Checksumming: Cyclic Redundancy Check view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that  exactly divisible by G (modulo 2)  receiver knows G, divides by G. If non-zero remainder: error detected!  can detect all burst errors less than r+1 bits widely used in practice (Ethernet, 802.11 WiFi)

4 7/12/2015 EEC484/584: Computer Networks 4 CRC Example Want: D. 2 r XOR R = nG equivalently: D. 2 r = nG XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ ] D.2rGD.2rG

5 7/12/2015 EEC484/584: Computer Networks 5 Medium Access Control Two types of “links”: point-to-point  PPP for dial-up access  point-to-point link between Ethernet switch and host broadcast (shared wire or medium)  old-fashioned Ethernet  802.11 wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)

6 7/12/2015 EEC484/584: Computer Networks 6 MAC Protocols Assumption  Single shared broadcast channel  Two or more simultaneous transmissions by nodes: interference  Collision if node receives two or more signals at the same time MAC protocols Distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit Communication about channel sharing must use channel itself!  No out-of-band channel for coordination

7 7/12/2015 EEC484/584: Computer Networks 7 Ideal MAC Protocol Broadcast channel of rate R bps 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M 3. fully decentralized:  no special node to coordinate transmissions  no synchronization of clocks, slots 4. simple

8 7/12/2015 EEC484/584: Computer Networks 8 MAC Protocols: a taxonomy Three broad classes: Channel Partitioning  divide channel into smaller “pieces” (time slots, frequency, code)  allocate piece to node for exclusive use Random Access  channel not divided, allow collisions  “recover” from collisions “Taking turns”  nodes take turns, but nodes with more to send can take longer turns

9 7/12/2015 EEC484/584: Computer Networks 9 Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 1 3 4 1 3 4 6-slot frame

10 7/12/2015 EEC484/584: Computer Networks 10 Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle frequency bands time FDM cable

11 7/12/2015 EEC484/584: Computer Networks 11 Random Access Protocols When node has packet to send  transmit at full channel data rate R.  no a priori coordination among nodes two or more transmitting nodes ➜ “collision”, random access MAC protocol specifies:  how to detect collisions  how to recover from collisions (e.g., via delayed retransmissions) Examples of random access MAC protocols:  ALOHA  slotted ALOHA  CSMA, CSMA/CD, CSMA/CA

12 7/12/2015 EEC484/584: Computer Networks 12 Pure ALOHA pure Aloha: simple, no synchronization when frame first arrives  transmit immediately collision probability increases:  frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1]

13 7/12/2015 EEC484/584: Computer Networks 13 Pure Aloha efficiency P(success by given node) = P(node transmits). P(no other node transmits in [p 0 -1,p 0 ]. P(no other node transmits in [p 0,p 0+1 ] = p. (1-p) N-1. (1-p) N-1 = p. (1-p) 2(N-1) … choosing optimum p and then letting n -> infty... = 1/(2e) =.18

14 7/12/2015 EEC484/584: Computer Networks 14 Slotted ALOHA Assumptions: all frames same size time divided into equal size slots (time to transmit 1 frame) nodes start to transmit only slot beginning nodes are synchronized if 2 or more nodes transmit in slot, all nodes detect collision Operation: when node obtains fresh frame, transmits in next slot  if no collision: node can send new frame in next slot  if collision: node retransmits frame in each subsequent slot with prob. p until success

15 7/12/2015 EEC484/584: Computer Networks 15 Slotted ALOHA Pros single active node can continuously transmit at full rate of channel highly decentralized: only slots in nodes need to be in sync simple Cons collisions, wasting slots idle slots clock synchronization

16 7/12/2015 EEC484/584: Computer Networks 16 Slotted Aloha efficiency suppose: N nodes with many frames to send, each transmits in slot with probability p prob that given node has success in a slot = p(1-p) N-1 prob that any node has a success = Np(1-p) N-1 max efficiency: find p* that maximizes Np(1-p) N-1 for many nodes, take limit of Np*(1-p*) N-1 as N goes to infinity, gives: Max efficiency = 1/e =.37 Efficiency : long-run fraction of successful slots (many nodes, all with many frames to send) At best: channel used for useful transmissions 37% of time! !

17 7/12/2015 EEC484/584: Computer Networks 17 CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission human analogy: don’t interrupt others!

18 7/12/2015 EEC484/584: Computer Networks 18 CSMA collisions collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes note: role of distance & propagation delay in determining collision probability

19 7/12/2015 EEC484/584: Computer Networks 19 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA  collisions detected within short time  colliding transmissions aborted, reducing channel wastage collision detection:  easy in wired LANs: measure signal strengths, compare transmitted, received signals  difficult in wireless LANs: received signal strength overwhelmed by local transmission strength

20 7/12/2015 EEC484/584: Computer Networks 20 CSMA/CD collision detection

21 Ethernet “dominant” wired LAN technology: cheap $20 for NIC first widely used LAN technology simpler, cheaper than other schemes kept up with speed race: 10 Mbps – 10 Gbps Metcalfe’s Ethernet sketch

22 802.3 Ethernet Standards: Link & Physical Layers Many different Ethernet standards  common MAC protocol and frame format  different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps  different physical layer media: fiber, cable application transport network link physical MAC protocol and frame format 100BASE-TX 100BASE-T4 100BASE-FX 100BASE-T2 100BASE-SX 100BASE-BX fiber physical layer copper (twister pair) physical layer

23 7/12/2015 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  used in 10BaseT  each bit has a transition  allows clocks in sending and receiving nodes to synchronize to each other no need for a centralized, global clock among nodes!

24 7/12/2015 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) http://www.tomshardware.com/forum/19951-42-detecting-length-ethernet-frame >= 64 bytes Not considered as part of the header!

25 7/12/2015 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

26 7/12/2015 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  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

27 7/12/2015 EEC-484/584: Computer Networks Wenbing Zhao Minimum Time to Detect Collision (in worst-case scenario) 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

28 EEC-484/584: Computer Networks 5-28 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 7/12/2015

29 EEC-484/584: Computer Networks 5-29 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 7/12/2015

30 7/12/2015 EEC-484/584: Computer Networks Wenbing 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?

31 7/12/2015 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?

32 7/12/2015 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?


Download ppt "EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao"

Similar presentations


Ads by Google