Medium Access Control (MAC)
Total Page:16
File Type:pdf, Size:1020Kb
1 Medium Access Control 2 Medium Access Control (1) The Network H2 H4 H1 H3 Broadcast networks have possibility of multiple access (MA) to a channel medium access control describes how we resolve the conflict assume only one channel available for communication additional channels would also be the subject of MAC 3 Medium Access Control (2) The Network H2 H4 H1 H3 4 Medium Access Control (3) The Network H2 H4 H1 H3 5 Medium Access Control (4) The Network H2 H4 H1 H3 assume when two frames overlaps at the Rx then both are lost, and thus both must be retransmitted assumption always be true in LANs in broadcast WANs might not be true 6 ALOHA protocol You can do nothing for MAC . The Network The Network The Network The Network H2 H4 H2 H4 H2 H4 H2 H4 H1 H3 H1 H3 H1 H3 H1 H3 ALOHA is contention based: a host may broadcast whenever necessary higher layers spot errors caused by collisions, and do retransmission 7 Performance of ALOHA H n vulnerable period for -1 start (λt) −λt Pn(t)= e t1 + t2 n! H1 To find p from Poisson Equation - t set t = 2T, λ = µG, n = 0: t2 -1 0 (µ 2T ) − H2 p = G e µG2T t1 + t2 - 0! −µG2T vulnerable period for H2 start p = e µ − S = e µG2T Let t1 = t2 = T µG µS successfully sent per second −µG2T µS = µGe µG sent (including failures) per second p is probability frame has no collisions µST frames are delivered in T µ seconds p = S µG −µG2T ρ = µST = µGe T 8 Is ALOHA good? ρ 6 0.4 0.3 0.2 0.1 0.0 - 0.0 0.5 1.0 1.5 2.0 2.5 3.0 µGT load of 50% gives maximum efficiency of 18% not a very satisfactory performance no way of assuring that even this maximum efficiency is reached 9 Improving basic ALOHA 1. slotted transmission: there are certain specific times when a host may broadcast. 2. carrier sensing: a broadcast is allowed only when the channel is idle. 3. token passing: a host may only broadcast when it holds some sort of token permitting it to do so. 4. distributed queueing: the hosts collaborate to form a queue of hosts ready to send data. 10 Slotted ALOHA n (λt) −λt vulnerable period for H1 start P (t)= e - n n! To find p from Poisson Equation H1 set t = T, λ = µG, n = 0: - t 0 (µ T ) − p = G e µGT H2 0! − - p = e µGT vulnerable period for H2 start µ − S = e µGT µG µS successfully sent per second − µ = µ e µGT µG sent (including failures) per second S G p is probability frame has no collisions µST frames are delivered in T µ p = S seconds µG −µGT ρ = µST = µGe T 11 Is Slotted ALOHA good? ρ 6 0.4 0.3 0.2 0.1 0.0 - 0.0 0.5 1.0 1.5 2.0 2.5 3.0 µGT now load of 100% loading gives maximum efficiency of 36% still not a very satisfactory performance small basic problems as ALOHA 12 Carrier Sensing The Network The Network The Network H2 H4 H2 H4 H2 H4 H1 H3 H1 H3 H1 H3 carrier sensing involves TI - checking that channel is idle H2 before transmission called CSMA U H1 probability TI of avoiding - TI +TP - TCS a collision TP 13 Collision Detection H3 causes collision H2 causes collision H1 H2 H3 H3 H2 H1 - - - - - transmission contention transmission idle transmission host senses the medium to know that its frame is OK transmission stopped as soon as collision occurs → collision detection (CD) MAC protocol called CSMA/CD host must transmit for long enough so as to know frame is OK thus minimum frame length is 2η where η is end-to-end transmission time 14 Worksheet: CSMA/CD A bus based network is being built using CSMA/CD for MAC, a cabling system with signal propagation speeds of 200 × 106ms−1, and a bit rate 1Mbs−1. 1. If two hosts H1, H2 are separated by 2,000m, how long does it take for a signal to travel between them? 2. If H1 has started to broadcast, and H2 starts to broadcast just before the signal from H1 arrives at H2, what will happen? 3. How long, from the time H1 starts transmitting, will it take H1 to find out about the event in question 2? 4. How many bits would be sent in that time? 5. If the data rate were increased to 10Mbs−1, how many bits would have been sent? 15 Length of bus network using CSMA/CD A bus-based network transmits 64 bit frames at 10 Mbs−1, propagation speed c = 200 × 106ms−1 What is the maximum end-to-end length l on the bus? l We know that the end-to-end propagation delay η = 200×106 64 −6 Also, the time to transmit a frame t = 10×106 = 6.4 × 10 Since the time to transmit a frame must be greater than 2η, we have: − 2l 6.4 × 10 6 > 200 × 106 l < 640m 16 Persistence Used slot N N + 1 N + 2 N + 3 1-persistent 1 0 0 p-persistent p (1 − p)p (1 − p)(1 − p)p non-persistent p p p once idle, it broadcasts with probability p → p-persistent CSMA if p = 1 → simply waiting for the channel to be free before broadcasting if p< 1 then wait with probability 1 − p for one frame, before broadcasting with probability p 17 Binary Exponential Back-off The basis of the MAC in Ethernet is 1-persistent CSMA/CD to avoid the poor performance of this protocol when network loads are high, a variation called binary exponential back-off is introduced. minimum frame length is treated as the slot length when the net is idle, a host may attempt to broadcast if a collision occurs, wait either 0 or 1 slots before attempting to broadcast again if another collision occurs waits 0, 1, 2 or 3 slots after c collisions we choose a slot in the range 0 to 2c − 1 for the next attempt upper limit of 1023 is placed on what this range 18 Binary Exponential Back-off (Light Load) Slot Slot Slot Slot 0 1 0 1 0 1 0 1 H2 H2 H2 H2 H1 H1 H1 H1 chances of collisions occurring are slight during transmission only a few hosts waiting to transmit probably only have a few hosts in contention 19 Binary Exponential Back-off (Heavy Load) Slot Slot Slot Slot Slot Slot Slot 0 1 0 1 0 1 0 1 0 1 0 1 0 1 H5 H5 H5 H5 H5 H5 H5 H4 H4 H4 H4 H4 H4 H4 H3 H3 H3 H3 H3 H3 H3 H2 H2 H2 H2 H2 H2 H2 H1 H1 H1 H1 H1 H1 H1 at any one time a number of hosts are likely to be in contention waiting only a few slots would mean a repeat collision is very likely binary exponential back-off algorithm to quickly adapts 20 Problems with CSMA/CD No notion of authority to broadcast collisions are inevitable in the worst case, a particular host may be delayed indefinitely Acceptable for many applications, such as office information systems Unacceptable for real time systems used in applications such as CAM time that a host waits must have a fixed upper bound. bandwidth available to each host must have a fixed lower bound. 21 Token Passing H2 H3 direction logical 6 node outside of ring of H4 logical ring token hosts token H1 H5 Hosts must posses a token in order to broadcast token passed from one host to another host has nothing to send → pass token on immediately host has something to send → sets a timer, and transmits until the timer expires or, it has no more data to send 22 Token Passing Performance No losses due to collisions, and therefore most of bandwidth available for data. η is the average delay between hosts B bits per second network timeout at each host is T The maximum frame size f obeys f = TB The maximum delay d given by d = N (η + T ) 23 IEEE 802 standard for LANs OSI IEEE Network Layer OSI Network Layer 802.2 LLC Sub-layer Data Link Layer 802.1D Bridging Sub-layer 802.3 802.4 802.17 MAC MAC MAC Sub-layer Sub-layer . Sub-layer Physical 802.3 802.4 802.17 Layer Physical Physical Physical Layer Layer Layer 802 standard sets out a framework: logical link control (LLC) sub-layer performs ARQ (802.2) Bridging might be present to link LANs (802.1D) 24 IEEE MAC Addressing byte0 byte1 byte2 byte3 byte4 byte5 I/ U/ local local local OUID OUID OUID G L id id id Each NIC card conforming to IEEE Standards will have 48 bit number written as six colon separated bytes in hex hbytei:hbytei:hbytei:hbytei:hbytei:hbytei I/G bit decides if individual or group address U/L bit decides if universally or locally administered host 00:90:27:A3:32:05 individual globally unique broadcast address FF:FF:FF:FF:FF:FF group locally unique allows for 7 × 1013 hosts 25 IEEE LAN standards Number Common Name Area MAC Topology 802.3 Ethernet LAN 1-persistent CSMA/CD Bus/Tree 802.4 Token Bus LAN Token Passing Bus/Tree 802.5 Token Ring LAN Token Passing Ring 802.6 DQDB MAN Distributed Queue Bus 802.9 isoEthernet LAN Ethernet + ISDN Star/mesh 802.11 WiFi LAN CSMA/CA Cellular 802.12 100BaseVG LAN Handshaking from hub Star/tree 802.15 Bluetooth PAN Adaptive FHSS Cellular 802.16 WiMAX MAN Connection oriented Cellular 802.17 Resilient Packet Ring LAN to WAN Distributed Queue Ring 26 802.3 Ethernet The IEEE 802.3 works over various cables and speeds Code Common Name Cable Len (m) Topology 1 10Base5 Thick Ethernet 2 inch coaxial cable 500 bus 10Base2 Thin Ethernet 75-ohm coaxial cable 180 bus 10BaseT Twisted Pair Ethernet Category 3 UTP 100 star 100Base-TX Fast Ethernet Category 5 UTP 100 star 100Base-FX Fast Ethernet Fibre optic 185 star 1000Base-T Gigabit Ethernet Category 6 UTP (4 pairs) 100 star 10GBase-T 10 Gigabit Ethernet Category 6a UTP (4 pairs) 100 star 10Mbs−1 standards have been in use for many years 100Mbs−1 common 1Gbs−1 common on new computers, hubs still a little expensive 27 10Mbs−1 Ethernet Thick Ethernet: provides longest lengths hosts are attached via transceivers length of drops from the main cable must not exceed 50m.