NETW 501 Communication Networks Tutorial 6 By: Mariham Wasfy Outline • Random Access Dynamic MAC Outline • Random Access Dynamic MAC o o ALOHA Slotted ALOHA CSMA CSMA/CD Random Access MAC o o ALOHA Slotted ALOHA CSMA CSMA/CD Random Access MAC o o ALOHA Slotted ALOHA CSMA CSMA/CD CSMA • Carrier Sense SENSE Medium Medium Access Access ∵ Busy ∴ Don’t send the frame ∵ Idle (Free) ∴ Send the frame CSMA • Vulnerable Period = Tprop A Ttrans = 2 Tprop = 1 B A 0 B C D D C 0 2 1 3 1 3 1 3 CSMA • Types: P Success 11Persistent Persistent NonPersistent Run Exponential Backoff Algorithm 1-P Failure PPPersistent Persistent CSMA • Collision Run Exponential Backoff Algorithm 11Persistent Persistent NonPersistent PPPersistent Persistent CSMA • Example A Ttrans = 2 Tprop A-B = 2 Tprop A-C = 1 B A 0 B C C 2 0 1 2 3 4 1 3 Random Access MAC o o ALOHA Slotted ALOHA CSMA CSMA/CD CSMA/CD • Carrier Sense Medium Access / Collision COLLISION Detection DETECTION A Ttrans = 2 Tprop = 1 B A 0 B C 2 0 1 2 1 3 4 3 Abort transmission when collision detected C CSMA/CD • Vulnerable Period = Tprop A Ttrans = 2 Tprop = 1 B A 0 B C D D C 0 2 1 3 1 3 1 3 NB: Number of trials CW: Clear window BE: Backoff window CSMA and CSMA/CD • Exponential Backoff Algorithm R value from 0 to 𝟐𝑩𝑬 −𝟏 CCA: Clear Channel Assessment ABORT Yes NB > max_NB ? No NB = 1 CW = 2 BE = min(BE+1, max_BE) SUCCESS Yes CW = 0? NB = 0 CW = 2 BE = min_BE Choose and wait R (time) Perform 2 CCA No CW = CW -1 No Yes CCA Success ? Tutorial 1. Consider an Ethernet of diameter 300 m, frame size 1500 bytes, Speed of 2.1 × 108 m/sec and transmission rate of 1 Mbps. a. Calculate the vulnerable period in CSMA. b. If CSMA/CD is used. Stations A & B are located at the edges of the network. Given that station A starts transmission at t and station B starts transmission at t + 0.5 µsec. i. At what time will B abort transmission? ii. At what time will A abort transmission? Given: • D = 300 m • Lframe = 1500 B • C = 2.1 × 108 m/sec • R = 1 Mbps 𝑫 𝟑𝟎𝟎 Tprop = 𝑪 = 𝟐.𝟏 ×𝟏𝟎𝟖 = 1.428 µsec 𝑺𝒊𝒛𝒆 Ttrans = 𝑹𝒂𝒕𝒆 = 𝟏𝟓𝟎𝟎 × 𝟖 𝟏 × 𝟏𝟎𝟔 A = 12 msec a. Vulnerable period in CSMA = Tprop = 1.428 µsec B Given: • A starts transmission at t • B starts transmission at t + 0.5 µsec 𝑫 A B 𝟑𝟎𝟎 Tprop = 𝑪 = 𝟐.𝟏 ×𝟏𝟎𝟖 = 1.428 µsec 𝑺𝒊𝒛𝒆 Ttrans = 𝑹𝒂𝒕𝒆 = 𝟏𝟓𝟎𝟎 × 𝟖 𝟏 × 𝟏𝟎𝟔 = 12 msec t + 1.928 µs t + 1.928 µs b. i. B aborts transmission @: t + Tprop = t + 1.428 µs ii. A aborts transmission @: t + 0.5 µs + Tprop = t + 1.928 µs t + 2.856 µs t t + 12 ms t + 0.5 µs A B t + 1.428 µs t + 12 ms 2. A channel using random access protocols has three stations on a bus with end-to-end propagation delay t. Station A is located at one end of the bus and stations B & C are located together at the other end of the bus. Frames arrive at the three stations and are to be transmitted at stations A, B & C at the respective time tA = 0, tB = 0.5 t and tC = 1.5 t. Frames require transmission time of 4t. in appropriate figures, with time at the horizontal axis, show the transmission activity of each of the three stations for: a. Non-persistent CSMA b. Non-persistent CSMA/CD tB = 0.5 t ttrans = 4 t tprop A-B = tprop A-C = t tprop B-C = 0 t a. Non-persistent CSMA B A A B C 0 1.5 t 0.5 tt 4t 5.5 t tA = 0 t C tC = 1.5 t 4.5 t5 t Busy doesn’t send and will back off 0.5 tt 1.5 t 4.5 t5 t tB = 0.5 t ttrans = 4 t tprop A-B = tprop A-C = t tprop B-C = 0 t a. Non-persistent CSMA B A A B C 0 0.5 t 4t 4.5 t tA = 0 t C tC = 1.5 t tB = 0.5 t ttrans = 4 t tprop A-B = tprop A-C = t tprop B-C = 0 t b. Non-persistent CSMA/CD B A A 0 1.5 t 2 t B 0.5 t t C 0.5 t tt 1.5 t tA = 0 t 4t C tC = 1.5 t 5t Busy doesn’t send and will back off 5t tB = 0.5 t ttrans = 4 t tprop A-B = tprop A-C = t tprop B-C = 0 t b. Non-persistent CSMA/CD B A A 0 B 0.5 t t C 1.5 t tA = 0 t C tC = 1.5 t 3. Consider the network shown below where terminals A, B, C and D are communicating over a bus with a central station. The transmission time for packets from terminal B and C is t units while the transmission time for packets from terminals A and D is 0.5 units. a. What is the vulnerable period in the following scenarios: (Calculate based on worst case scenario) i. 1-persistent CSMA ii. Non-Persistent CSMA/CD b. Provided that terminals A,B,C and D start their transmission at tA=1.5t, tB=0.5t, tC=2t and tD=2t respectively. Assuming that A & C implement 1-persistant CSMA/CD while B & D implement Non-persistent CSMA/CD. Show the transmission activity for the four stations in the plot below until 6t. (Assume that back-off interval is equal to 1.5t for all terminals) c. Indicate the time interval during which node D senses the channel to be idle. d. Indicate which of the four packets will be received correctly at central station and which will suffer from collision on timing diagram. a. The vulnerable period: i. ii. 1-persistent CSMA Non-Persistent CSMA/CD Vulnerable period 1-persistent CSMA = Vulnerable period Non-Persistent CSMA/CD = Tprop_MAX TpropA-B = t TpropA-Central Station = 1.5 t TpropA-C = 2t TpropA-D = 3t TpropD-C = t TpropD-Central Station = 1.5 t TpropD-B = 2t TpropD-A = 3t ∴3t b. back-off interval is equal to 1.5 t for all terminals A B C D Send at 2.5 t 1.5 0.5 t 2.5 2tt 2t Tt 0.5 t t t 0.5 t Tp A-Bt A-C2t A-D3t B-At B-Ct B-D2t C-A2t C-Bt C-Dt D-A3t D-B2t D-Ct Proto col 1persistant CSMA/CD Nonpersistent CSMA/CD 1persistant CSMA/CD Nonpersistent CSMA/CD c. Node D will sense the channel idle at: From 0 to 2 t From 4 t to 5.5 t From 6 t to further d. All 4 packets received correctly at central station A B C D Send at 1.5 t 2.5 0.5 t 2.5 25tt tt 4.5 2t Tt 0.5 t t t 0.5 t Tp 1.5 t 0.5 t 0.5 t 1.5 t Proto col 1persistant CSMA/CD Nonpersistent CSMA/CD 1persistant CSMA/CD Nonpersistent CSMA/CD Backoff 4. Four stations are located on a bus network as shown below. The distance between station A and B is 2d meters. The distance between A and H is d meters. The distance between station H and C is 3d meters. The propagation delay between A and C is t sec. Frames arrive at the four stations A, B, C and H at times tA=0, tB= 0.75 t, tC= 2.5 t and tH=2.75 t respectively. All frames require transmission time of t sec. If we assume that the stations A, C, H apply 1-persistent CSMA/CD while station B applies Non-Persistent CSMA/CD. Show the transmission activity for the four stations in the plot below until 6t. (Assume that if collision is detected or occurs for terminals A & C the back-off window size is 2 slots while if collision is detected or occurs for terminal B & H the back-off window size is 1 slot) A B H C D A-B2d A-Hd A-C4d B-A2d B-Hd B-C2d H-Ad H-Bd H-C3d C-A4d C-B2d C-H3d Tprop A-C t Cross multiplication Distance Tprop 4d t 3dd 2 x x= 𝑡×3𝑑 𝑡×𝑑 𝑡×2𝑑 𝑡 3𝑡 2𝑡 = = 4𝑑 4𝑑 4 4 𝑡 2 = A B H C Send at 0 1.75 t 0.75 3t t 2.75 3.25 5.75 2.5 ttt Tt t t t t Tp A - B 0.5t A - H 0.25t A-Ct B - A 0.5t B – H 0.25t B - C 0.5t H-A2t H - B 0.25t H - C 0.75t C-At C - B 0.5 t C - H 0.75t Prot ocol 1persistant CSMA/CD Nonpersistent CSMA/CD 1persistant CSMA/CD 1persistant CSMA/CD Back off 2 slots 1 slot 1 slot 2 slots Backoff Backoff