Professional Documents
Culture Documents
3.1 3.2 3.3 3.4 3.5 Introduction Framing and Error Control Flow Control and Retransmission Medium Access Control LAN
103 3 -98
- When a "collision" occurs, the signals will get distorted and the frame will be lost the link bandwidth is wasted during collision - Question: How to coordinate the access of multiple sending and receiving nodes to the shared link??? - Solution: We need a protocol to determine how nodes share channel Medium Access control (MAC) protocol - The main task of a MAC protocol is to minimize collisions in order to utilize the bandwidth by: - Determining when a node can use the link (medium) - What a node should do when the link is busy - What the node should do when it is involved in collision
3 -99
2- FDMA: frequency division multiple access - Channel spectrum is divided into N frequency bands, one per user - Each node is assigned fixed frequency band - If the channel rate is R bps and number of users is N, each user gets R/N - All nodes can access the channel at the same time without collision - Unused transmission time in frequency bands go idle - Example: 6 nodes, if only nodes 1, 3, and 4 have frames, frequency bands 2, 5, and 6 go idle
frequency bands
FDM cable
3 -103
1- Polling Protocol:
- A master (central) node coordinates which node uses the channel - Master node invites slave nodes to transmit in turn - Request to Send, Clear to Send messages
data
data poll
master
slaves
3 -105
- All data exchanges are done through the master - When the master has a frame to send, it sends a select frame that includes the address of the intended slave - When the master is ready to receive data, it send a Poll frame for each node to ask if it has data to send or not. If yes, data will be transmitted, otherwise NAK is sent. - Concerns: polling overhead and latency - single point of failure (master) 3 -106
2- Token passing: - Control token passed from one node to next sequentially. - To transmit: - Wait for a token - Capture (or hold) the token - Begin transmitting data (while holding token) - If allocated time is expired or data transmission finishes, release the token (send it to the next node), i.e., passes the access right - If the next node has no data to send, it just passes the token to the next node 3 -107
T
3 -108
3 -109
Retransmission
t0
t0+X
t0+X+2tprop+ B
3 -110
Throughput Analysis
t0 X
t0
t0 + X
- X: frame transmission time, assuming constant time, i.e., fixed frame length - S: throughput, average number of successful frame transmissions per second - G: load, average number of transmission attempts by all nodes during one frame transmission time - Psuccess : Probability that a frame transmission is successful = the probability that there are no additional transmissions in the vulnerable period (2X seconds). 3 -111
- Any transmission that begins during the vulnerable period leads to collision - If node A starts transmission at time t0, A can guarantee that its transmission is successful (collision-free) if no other node starts transmission during [t0 - X, t0 + X], i.e., X sec before and X sec after As transmission. - The users frame transmissions during period X (either new or retransmissions) is a Poisson process with average rate of G transmission-attempts per frame-time - The probability of k transmission-attempts during the vulnerable period (2X):
( 2G ) e 2G P(k ) =
k
k!
- Channel utilization or efficiency or throughput (S) is: the long-run percentage of the transmitted frames that arrive successfully (without collisions) or the percentage of the channel bandwidth that will be used for transmitting frames without collisions - Note: S < G because of collisions S = rate of frame transmissions * P(successful transmission) = G * P(0 other transmissions in 2 X) = G * P(k = 0)
S = GPsuccess
2G 2G 2G = GP(0) = G e = Ge 0!
N is the number of nodes, P is the probability a node transmits in period X G = NP = the average number of transmissions in X (binomial 3 -113 distribution)
0.36
0.184
Slotted Aloha
Pure Aloha
0.5 1.0 1.5 2.0
G = offered load = Np
- Throughput S reaches a peak value of 0.5/e at load G = 0.5, and then declines back toward 0 - For a given value of S, there are two corresponding values for G: 1- For small G: S G, there is nearly no collision, S is small because the load is small (there are few transmissions) 2- For large G: G >> S, there are many backlogged users, S is small because there are many collisions 3 -114
- Given N and G = 0.5, we can compute optimal P - ALOHA protocol cannot achieve throughput higher than 18.4 percent - If there are F frames/s, then 0.18 * F frames will arrive successfully on average without the need for retransmission. - The maximum channel utilization is 18.4% of the physical channel capacity you buy 1 Mb link, throughput will never be more than 180Kb! - MAC protocol constrains the effective channel throughput Simple improvement but big impact - Why vulnerable for 2 time slots?
3 -115
- Send only at the beginnings of time slots vulnerable for one time slots less collision probability higher efficiency
2- Slotted ALOHA
- Time is divided into slots equal to frame transmission time - Nodes are synchronized - A node can transmit at the beginning of a slot only - If a node misses the beginning of a slot, it has to wait until the beginning of the next slot and transmits the entire frame in the slot, i.e., packets overlap completely or not at all 3 -116
- If there is a collision, the node retransmits its frame in each subsequent slot with probability p until the frame is successfully transmitted - In unslotted ALOHA: Collision probability frame sent at t0 collides with other frames sent in [t0-X, t0+X] - In slotted ALOHA: Collision probability frame sent at t0 collides with other frames sent in [t0, t0+X]
Throughput Analysis
S = GP ( no collision ) = GP ( no other tran smissions in the slot )
( G) =G
0!
e G = G e G
3 -117
0.368
Ge-G
Slotted Aloha
0.184
Ge-2G
Pure Aloha
0.5 1.0 1.5 2.0
G = offered load = Np
- When G = PN < 1, as P (or N) increases - Probability of empty slots reduces - Probability of collision is still low, thus S increases - When G > 1, as P (or N) increases: - Probability of empty slots does not reduce much, but - Probability of collision increases, thus S decreases - S is optimal when G = 1
3 -118
- At its best: channel use for successful transmissions is 37% of the time. - e.g. For a network with 100 Mbps, the successful throughput < 37 Mbps using Slotted ALOHA protocol. - The probability that no other transmission is sent during the same time slot is e-G (= The probability that a frame avoid collision) - The collision probability is 1-e-G. - The probability that k attempts are required for a successful transmission is
Pk = e (1 e )
G k 1
E = kPk = ke G (1 e G )k 1 = eG
k =1 k =1
3 -119
ALOHA: Evaluation
Pros - A node can transmit frames continuously at the full rate of channel if it is the only node with frames - Highly decentralized: only nodes need to be synchronized - Simple to be implemented - Decentralized: No master station is needed to control the medium robust against failure of a host Cons - Collisions wasting slots low channel utilization only 0.37 and 0.18 of the channel rate - Slotted ALOHA needs slot synchronization - High load implicates low utilization of the channel and high delays
3 -120
- If medium is idle (no voltage sensed): transmit entire frame - If medium is busy, defer transmission and wait (or backoff) and retry again - Collision: entire frame transmission time is wasted
3 -121
- CSM can reduce the possibility of collision but it cannot eliminate it: Collision can only happen when more than one node begin transmitting within a short time (the propagation time period) - Propagation delay means two nodes may not hear each others transmission - The longest collision detection time occurs when node A at one end of the cable starts transmitting and node B at the other end of the cable starts its transmission just before the signal from A has reached it.
A begins to transmit at t=0 A detects collision at t= 2 tprop-
A A
B B
B begins to transmit at t = tprop- B detects collision at t = tprop 3 -122
- Node A detects the collision when the signal from B reaches it, i.e., about one round trip propagation time after node A starts transmission. - Maximum propagation delay (tprop): the taken time for a bit to travel between the two most widely separated stations. - tprop = d/V seconds, d is the distance between the two most widely nodes and V is the speed of the signal - i.e., in the worst case, it takes 2tprop to find out if channel has been captured - Vulnerable period is 2tprop (due to channel capture effect) - If A sends a frame at time t0, A can guarantee that its transmission is collision free if there is no other node starts transmission in [t0-tprop, t0+tprop], because all the nodes should know about As transmission and will not send
3 -123
- The longer the propagation delay the larger the collision probability the worse the performance of the protocol - Can you guess why there is a restriction on the bus length? - Distance & signal propagation speed play important role in determining collision probability - If 2tprop > 2 X (or if a = tprop/X > 1), no gain compared to ALOHA - If 2tprop > X (or if a = tprop/X > 0.5), no gain compared to slotted ALOHA - Remember: X = frame length/link bit rate THINK How cable length signal speed frame length link bit rate affect the performance? These applets explain different protocols in this course http://wps.aw.com/aw_kurose_network_3/0,9212,140634 6-,00.html 3 -124
- Three options when a node has a frame to transmit but the channel is busy 1) 1-Persistent CSMA (most greedy): - Start transmission as soon as the medium becomes idle - Nodes continuously sense the medium - Send frame as soon as the medium is idle low delay - Avoid idle channel time - A medium is used once it is idle - Large collision probability: If two nodes become ready in the middle of the transmission of a third one, both with start transmitting as soon as they find the channel idle after the 3rd nodes transmission is over collision guaranteed
3 -125
2- Non-persistent CSMA (least greedy) - A node with frames to be sent should:1- Sense the medium, if it is idle, send; otherwise, go to 2 2- The node waits for a random time (a backoff period) then go to step 1 - Fewer collisions: Random delays reduces probability of collisions because nodes with data will send at different times - Longer delay to transmit
Random Waiting times Wasted time
3 -126
- Bandwidth is wasted if waiting time is large because medium will remain idle following end of transmission even if only one node has frames to send 3) p-persistent CSMA (adjustable greedy): - When a node has data to send, it senses the medium: 1- If the medium is idle: the node sends with probability p. 2- Otherwise, wait one time slot (= maximum propagation delay) & re-sense with probability 1-p then go to step 1 - Reduces the possibility of collisions like nonpersistent and reduces channel idle time like 1-persistent
3 -127
- Collision Detecting: if the sensed power is more than the transmitted power, it means collision occurs - Easy in wired LANs but difficult in wireless LANs why? 1- In wireless LANs: received signal strength is overwhelmed by the senders signal strength due to weak received signals 2- Can not detect collisions in case of hidden terminal. - We care about the collision at the receiver, sender cannot detect collision at receiver if there is transmission from hidden terminal because neighborhood of sender and receiver are not the same (its not a shared wire). The sender can not hear all transmissions received by receiver
Hidden terminal problem: A and C can each communicate with B, but are hidden from each other A cannot detect collision with C because it cannot hear its transmission 3 -129
3 -130
- Efficiency: the long-run fraction of time during which frames are sent without collisions when there is a large number of active nodes, with each node having a large number of frames to send - Channel efficiency = ttran/(contention period + ttran) - Contention period = number of contention slots x time of one contention slot - Time of one contention slot = 2tprop
3 -131
- The probability that a node gets the channel is e-G see 3-119
- The max. probability that a node gets the channel is e-1 see 3-119 when G = PN = 1 - Average number of contention slots = e (geometric distribution) we try approximately e times before each successful transmission
Efficiency( ) =
- Efficiency goes to 1 as tprop goes to 0 collisions are detected within short time and colliding transmissions aborted faster, reducing channel wastage - Efficiency goes to 1 as ttran goes to infinity - ttran = frame length/bit rate better efficiency as bit rate decrease or frame length increase - For the same efficiency, increasing bit rate frame length decreasing the
3 -132
1-Persistent CSMA
a = 0.01
0.16
a =0.1 a=1 G
- a has important impact on the throughput - When a approaches 1, CSMA is worse than ALOHAs, why? - At low value of G, a has little effect on S because collision probability is low 3 -133
1 0.8
Smax
0.6
Slotted ALOHA
0.4
ALOHA
0.2 0 0.01 0.1 1
a = tprop/ttran
- For small a: CSMA-CD has best throughput - For larger a: Aloha & slotted Aloha better throughput
3 -134
Comparison of the channel utilization versus load for various random access protocols.
3 -135
Outline
3.1 Introduction 3.2 Framing and Error Control 3.3 3.4 3.5 Flow Control and Retransmission Medium Access Control LAN
LANs
- Key idea: reduce number of links by sharing links among many computers reduces the cost - But ... attached computers compete for use of shared link - Often a shared medium when a computer transmits, other computers can receive the transmission - Key features of a LAN - High throughput - Relatively low cost - Limited to short distance - Most dominant technology is Ethernet.
3 -137
1A-2F-BB-76-09-AD
= adapter
0C-C4-11-6F-E3-98
3 -138
3 -139
- MAC address is assigned to a device portable it does not change when a card moves from one LAN to another
4: - IP address is used by network layer to get datagram to the destination IP subnet - MAC address is used by link layer to get frame from one node to another physically-connected node in the same network 5: - IP address is like postal address changes when you move also hierarchical (country city street ---) - MAC address like social insurance number related to a person the same address when you move
- Why separate IP and MAC addresses? - Assign adapters an IP address hardware only works for IP cannot be used for other protocols (no IPX, DECNET) - Use MAC address as network address aggregation No route
3 -140
- TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)
0C-C4-11-6F-E3-98 137.196.7.88
3 -141
- A wants to send a datagram to B, and Bs MAC address not in As ARP table. - To find the MAC address of B, A broadcasts ARP query packet, containing B's IP address - Destination MAC address = FF-FF-FF-FF-FF-FF - All machines on LAN will process ARP query - B receives ARP packet, replies to A with its (B's) MAC address. Frame is sent to As MAC address (unicast) - A stores IP-to-MAC address pair in its ARP table until the information becomes old TTL expires - ARP is plug-and-play: - Nodes create their ARP tables without intervention from net administrator
3 -142
Routing on a LAN
- Send directly to the destination if it is determined to be on the same LAN - Send to a default router otherwise - Either case, the host must know the MAC address of the destination or the default router - Given a nodes IP address, how can a host determine its MAC address? ARP table or ask a server. - Given a nodes IP address, how can a host determine if it is in the same network or different? Using the subnet mask as we will discuss next chapter - Does a sender need the destination MAC if it resides in a different network? No
3 -143
A
111.111.111.111 74-29-9C-E8-FF-55
B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F
3 -144
- A creates IP datagram with IP source A, destination B - A creates link-layer frame with R's MAC address as destination, frame contains A-to-B IP datagram - As adaptor sends frame to R
MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F
3 -145
- Rs adaptor receives the frame, extracts IP datagram from the frame and passes it up to IP layer - R sees that the destination is B that is in its LAN, uses ARP to get Bs MAC address, and creates a new frame containing A-to-B IP datagram with MAC destination address set to Bs.
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222
IP Eth Phy
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F
3 -146
- R forwards the frame to B - At B: the link layer can know that the frame is sent from R, and the network layer can know that the datagram was sent from A.
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F
3 -147
LAN topology
- Bus topology popular through mid 90s - All nodes in same collision domain (can collide with each other) - Today: star topology prevails - Active switch in center (instead of hub) - Each node runs a (separate) Ethernet protocol (nodes transmissions do not collide with each other)
3 -148
twisted pair
3 -149
- Each connected LAN referred to as LAN segment - Cant connect different Ethernet types (e.g., 10BaseT & 100BaseT) because segments dont share the same rate. - Single collision domain: Hubs do not isolate collision domains a node may collide with any node residing at any segment in LAN - Hub advantages: simple, inexpensive, extend max distance between nodes, but all the segments become one large collision domain Backbone hub
10BaseT
10BaseT
10BaseT
156
Computer science
Electrical Engineering
System Engineering
3 -150
Switch
- Link layer device - Stores and forwards Ethernet frames different types of Ethernet can be connected since it is a store and forward device. - Examines incoming frame header and selectively forwards frame to one-or-more outgoing links based on MAC destination address - Uses CSMA/CD to forward a frame on a segment - Transparent: hosts are unaware of presence of switches no need for any change to hosts LAN adapters - Switch isolates collision domains since it buffers frames higher total max throughput comparing to hubs
3 -151
- Smarter than hubs, take active role - No limit on number of nodes or on geographical coverage - Hosts have dedicated and direct connection to switch - Switch allows multiple simultaneous transmissions, e.g., A-to-A and B-to-B, without collisions. Not possible with hub - How does switch know that A reachable via interface 4, B reachable via interface 5? Switch Table
3 -152
Switch Table
- Each switch has a switch table, each entry: <MAC address of host, interface to reach host, time stamp> - Stale entries in table dropped (TTL can be 60 min) - How are entries created and maintained in switch table? - Self-learning: Switch learns which hosts can be reached through which interfaces How? - When a frame is received, switch learns location of sender - Records sender/location pair in switch table - Frame destination location is unknown: flood - Destination location is known: selectively send on just one link 3 -153
Interconnecting switches
S4 S1 A B C S2 F D E G H I
S3
- Individual LAN restrictions pose limits on number of nodes in same collision domain and on geographical coverage - Switches can be connected together Q: sending from A to G: how does S1 know to forward frame destined to F via S4 and S3? A: self learning! (exactly the same as in single-switch case!)
3 -154
Traffic isolation
- Switch installation breaks subnet into LAN segments - Forwarding is selective: If destination on segment from which frame arrived then drop frame do not forward onto other LAN segments All connected segments can work independently in parallel - Segments become separate collision domains
3 -155
Interconnecting LANs
Q: Why not just one big LAN? Why we need to use switch - Limited amount of supportable traffic: on single LAN, all nodes must share bandwidth - Limited cable length: Ethernet specifies maximum cable length - Large collision domain (can collide with many nodes) - Limited number of nodes, e.g., token ring has token passing delays at each node
3 -156
Both have forwarding tables: - Routers: compute tables using routing algorithms, IP addresses - Switches: learn forwarding table using flooding, learning, MAC addresses - Switches: Good in small networks (few hundred hosts) - Routers: Good in large networks (thousands of hosts)
physical switch
network datagram link frame physical applicatio n transport network link physical
3 -157
Institutional network
mail server router web server
to external network
IP subnet
3 -158
Ethernet
- dominant wired LAN technology - Cheap $20 for NIC - Bus or star - Uses CSMA/CD medium access control mechanism to detect and recover from a collision. - 10 Mbps 10 Gbps - Connectionless service: No handshaking between sending and receiving NICs - Unreliable service: receiving NIC doesnt send ACKs or NACKs to sending NIC - gaps can be filled using TCP - Ethernet Address: 6-bytes (48 bits) embedded into the Network Interface Card (NIC). Each Ethernet card has a globally unique address (IEEE and vendor assigned).
3 -159
- Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 - used to denote start of frame - Source/destination addresses: 6 bytes (48 bit) Destination address all 1's for broadcast packet - Type of protocol data unit (PDU): 2 bytes - indicates higher layer protocol (IP, Novell IPX, AppleTalk, etc) - CRC: 4 bytes. Checked at receiver, if error is detected, frame is dropped
3 -160
- Data: contains datagram handed down from upper layer - max packet length is 1500 bytes - min. data length is 46 bytes - padding (dummy bits) is used to ensure data plus padding at least 46 bytes
How two nodes in an Ethernet network communicate? - The sender broadcasts Ethernet frame. The destination is specified in the frame using its Ethernet (MAC) address. - All the nodes in the network listen for an Ethernet frame with their Ethernet address in it. - Only the destination processes the frame and sends it to 3 -161 the higher layers for further processing.
Ethernet technologies
- Different Ethernet standards have different speeds (2 Mbps to 10G bps) and different physical layer media (fiber, cable) - 10Base2: bus topology, 10 Mbps, repeaters (amplifies and retransmits bits) used to connect up to multiple segments collision detection excess current no two nodes can be separated by more than 0.925 km (how many segments?) - 10BaseT: Star topology, 10Mbps. - 1000Base-FX: Gigabit Ethernet - 1Gbps over Fiber Optics
185
2 3 -162
- The cots for higher bit rate - Increasing the minimum frame length because many dummy bits will be sent - Decreasing the maximum cable length - solution for 100BaseT is not good smaller network
- Why is the maximum cable length of a 10Mbps ethernet cable 10 times longer than the maximum cable length of a 100Mbps ethernet? The minimum frame length in Ethernet is independent of bit-rate. - Modern 10Mb Ethernet: 500m maximum segment length - can add repeaters up to a maximum 5 segments (2500m) tprop = 2500m/1.8 x 108 m/s ~ 12.5us one-way delay - add repeater and tranceiver delay 2 tprop = 51.2us
5-170
3 -164
- This process is repeated till the frame is transmitted successfully, for a maximum of 16 times. The frame is discarded after the 16th retry. - Ethernet uses the exponential backoff algorithm to determine the best duration of the random waiting period after the collision happens Exponential Backoff Algorithm - After experiencing Kth collision for a frame, NIC selects a random number R from {0, 1, , 2K-1} backoff period = R x min. frame transmission time (= 512 x 0.1 = 51.2 usec for Ethernet 10-Mbps LAN) After first collision (K=1): choose R from {0 ,1} After second collision: choose R from {0, 1, 2, 3} after ten collisions, choose R from {0, 1, 2, 3, 4,, 1023}
3 -166
Advantages of Exponential Backoff Algorithm: - Reduces the chance of two waiting nodes picking the same random waiting time to avoid repeated collisions (different hosts will have different values of R) - Backoff interval dynamically adjusts to load - When network traffic is light, it results in minimum waiting time before transmission small values of K - As traffic is high, collisions increase the waiting times are larger to reduce the probability of collision. larger K longer backoff interval
3 -167
- No flow control Error recovery, flow control, data re-ordering all delegated to higher layers!
3 -168
1- Flag: delimiter (framing) - determine the end of one frame and the start of the next one. 2- Address: does nothing (only one option) 3- Control: does nothing; in the future possible multiple control fields 4- Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc) 5- Payload: upper layer data being carried, default maximum is 1500 bytes 6- Checksum: cyclic redundancy check for error detection
3 -169
Internet
- Hosts can communicate to AP if they are in its coverage area. - 802.11g: 2.4-5 GHz range - up to 54 Mbps - 802.11n (multiple antennae): 2.4-5 GHz range up to 200 Mbps
AP
BSS 2
3 -170
3 -171
- Collision detection is difficult in wireless networks, why? see slide 3-129. How to reduce collision due to hidden terminal?
- Nodes hearing CTS should remain silent to not interfere with data frame - By this way, RTS and CTS are used to reserve the medium
Hidden terminal
3 -173
Questions
Mohamed M E A Mahmoud