EEE449 Computer Networks The Data Link Layer Part 2: Media Access Control En. Mohd Nazri Mahmud MPhil (Cambridge, UK) BEng (Essex, UK) nazriee@eng.usm.my Room 2.14 Semester 1 2011-2012 Media Access Control • In shared media, we need to manage the sharing process before the data transfer • When nodes are connected and use a common link (ie multipoint or broadcast link) we must – Ensure that each node gets access to the link – Prevent any data “collision” between nodes – Handle the collisions when they occur Semester 1 2011-2012 Media Access Control • Random access protocols for multiple access – Contention-based – No node is superior to another node – Node that wishes to send data uses a procedure to make sending decision – No predefined schedule – Collisions damage data Semester 1 2011-2012 Media Access Control • Protocol 1: Pure ALOHA – The earliest random access method – Developed in 1970’s for ALOHAnet, a pioneering computer networking system developed at the University of Hawaii – ALOHAnet became operational in June, 1971, providing the first public demonstration of a wireless packet data network – In the 1970s ALOHA random access was employed in the widely used Ethernet cable based network and then in both Wi-Fi and in mobile telephone networks in the 1980’s. – When collision occur, each node waits for a random amount of time (called backoff time) before retrying – After a maximum number of failed retry, nodes must give up and try later – Prodecure and parameters (discussion) Semester 1 2011-2012 Media Access Control • Pure ALOHA throughput analysis discussion Semester 1 2011-2012 Media Access Control • Protocol 2: Slotted ALOHA – Time is divided into slots whose duration last for a frame-time – Nodes must send only at the beginning of the time slot – Nodes must wait until the next time slot if they miss the current one – The vulnerable time is halved from the Pure ALOHA case Semester 1 2011-2012 Media Access Control Semester 1 2011-2012 Media Access Control • Protocol 3: CSMA – Nodes must sense the medium before attempting to send – Due to propagation delay a node may mistakenly sense an idle medium – The vulnerable time is equal to the propagation time – “Sense before send” can reduce collision but cannot eliminate it – The first implementation of CSMA was the Semester 1 2011-2012 Ethernet Media Access Control • Protocol 3: CSMA – Can employ one of the four access modes: Nonpersistent,1-persistent, P-persistent or Opersistent modes – Nonpersistent mode • When the sender (station) is ready to transmit data, it checks the physical medium • If the medium is idle, transmits a frame • In case of a busy medium, the sender waits for a random period of time and attempts to transmit again Semester 1 2011-2012 Media Access Control • Protocol 3: CSMA – 1-persistent mode • When the sender (station) is ready to transmit data, it checks if the physical medium CONTINOUSLY until it becomes idle, and then it transmits a frame • If the medium is busy, continue to listen until finds idle • In case of a collision, the sender back-off for a random period of time and attempts to transmit again • 1-persistent CSMA is used in the Ethernet Semester 1 2011-2012 Media Access Control • Protocol 3: CSMA – P-persistent • When the sender is ready to send data, it checks continually if the medium is busy • If the medium becomes idle, the sender transmits a frame with a probability p. • If the station chooses not to transmit (the probability of this event is 1-p), the sender waits until the next available time slot and transmits again with the same probability p. • In case of a collision, the sender waits for a random period of time and attempts to transmit again • p-persistent CSMA is used in WiFi and other packet radio systems. Semester 1 2011-2012 Media Access Control • Protocol 3: CSMA – O-persistent • Each node is assigned a transmission order by a supervisor station • When medium goes idle, nodes wait for their time slot in accordance with their assigned transmission order • The station assigned to transmit first transmits immediately • The station assigned to transmit second waits one time slot • Stations monitor the medium for transmissions from other stations and update their assigned order with each detected transmission Semester 1 2011-2012 Media Access Control • Protocol 3: CSMA – Although more efficient than ALOHA or Slotted-ALOHA, the medium remains unusable for the duration of transmission of both damaged frames. – For long frames, the unusable time can be significant and the capacity wasted can be considerable Semester 1 2011-2012 Media Access Control • Protocol 4: CSMA/CD – Nodes must sense the medium before attempting to send – If collision occurred and is detected, node stops transmitting that frame, transmits a jam signal, and then waits for a random time interval before trying to resend the frame. – Only part of the transmission time is used for a partial frame transmission – improve CSMA performance by terminating transmission as soon as a collision is detected, thus shortening the time required before a retry can be attempted. – Used in the Wired LAN (The Ethernet) – IEEE 802.3 standard. – Discussion on procedure Semester 1 2011-2012 Media Access Control • What about wireless network? • Can the 4 protocols work? Why or Why not? Semester 1 2011-2012 Media Access Control • Hidden nodes in a wireless network refer to nodes that are out of range of other nodes or a collection of nodes. • In a wireless network, it is likely that the node at the far edge of the access point's range (A) can sense the access point, but it is unlikely that the same node can sense a node on the opposite end of the access point's range, B. • The problem is when nodes A and B start to send packets simultaneously to the access point. Since node A and B can not sense the carrier, collision cannot be detected. • The hidden node problem can be observed easily in widespread (>50m radius) WLAN setups with many nodes that use directional antennas and have high upload. Media Access Control • • • • • • • • • Protocol 5: Carrier sense multiple access with collision avoidance (CSMA/CA) is a wireless network multiple access method differs from CSMA/CD due to the nature of the medium, the radio frequency spectrum. One of the problems of wireless data communications is that it is not possible to listen while sending, therefore collision detection is not possible. Collision avoidance is used to improve CSMA performance by not allowing wireless transmission of a node if another node is transmitting, thus reducing the probability of collision supplemented by the exchange of a Request to Send (RTS) packet sent by the sender S, and a Clear to Send (CTS) packet sent by the intended receiver R. RTS/CTS alerts all nodes within range of the sender, receiver or both, to not transmit for the duration of the main transmission CSMA/CA is used in 802.11 based wireless LANs Discussion of procedures Media Access Control • Protocol 5: Carrier sense multiple access with collision avoidance (CSMA/CA) – IFS – Interframe Spacing – transmission is deferred for an IFS even if the medium is idle because a distant (out of range) node may have already transmitted but the frame has not been detected. – Contention Window – After waiting for an IFS and the channel is still idle, node must wait until its time slot arrive. Node choose a random number of slot as its waiting time. – RTS/CTS exchange – When its time slot has arrived, sender send RTS to request for transmission and wait for receiver to grant permission and also to alert other nodes to wait.