41
Medium Access Control Sub Layer

csma (1)

Embed Size (px)

DESCRIPTION

gh

Citation preview

  • Medium Access Control Sub Layer

  • 12.*

  • Contents

    Multiple Access ProtocolsALOHACarrier Sense Multiple Access ProtocolsCollision-Free Protocols

  • The Channel Allocation ProblemIn broadcast networks the key issue is how to determine how gets to use the channel when there is competition for itStatic Channel Allocation in LANs and MANsFDM or TDM allocationProblems when there is a large number of users, since spectrum will be wastedDynamic Channel Allocation in LANs and MANsA number of assumptions are in place

  • Dynamic Channel Allocation (1)Station Model.The model consists of N independent stationsSingle Channel Assumption.A single channel is available for all communicationsCollision Assumption.If two frames are transmitted simultaneously , they overlap in time and the resulting signal is garbled. This event is called a collision. All station can detect collisionsA collided frame must be transmitted again latterThere are no errors other than those generated by collisions

  • Dynamic Channel Allocation (2)(a) Continuous TimeFrame transmission can begin at any timeThere is no master clock dividing the time into discrete intervals (b) Slotted TimeTime is divided into discrete intervals called slots. Frame transmission begins at the beginning of the slotA slot may be idle, may have one frame (legal) and may have multiple frames (collision)(a) Carrier SenseStations can tell if the channel is in use before trying to use itIf channel is in use, no station will attempt to use it before goes idle (b) No Carrier SenseStations cant sense the channel before trying to use itThey go ahead and transmit only later they can say it was an error

  • Multiple Access ProtocolsALOHACarrier Sense Multiple Access ProtocolsCollision-Free ProtocolsWireless LAN Protocols

  • Pure ALOHA (1)In pure ALOHA, frames are transmitted at completely arbitrary times.

  • 12.*Figure 12.3 Frames in a pure ALOHA network

  • Pure ALOHA (2)Frame time the amount of time needed to transmit the standard fixed length frameAn infinite population of users generates new frames according to a Poisson distribution, with mean N frames per time frame. If N >1 than more frames than the channel can handle0
  • Pure ALOHA (3)

    In addition to new frames, stations generate retransmissions. The probability of k transmission attempts per frame time, old and new combined, is also Poisson, with mean G per frameG >= N (equal when there are no retransmissions)Throughput of a channel is:S = G P0, where P0 is the probability that a frame doesnt suffer collisions

  • Pure ALOHA (3)Vulnerable period for the shaded frame.

  • 12.*Figure 12.5 Vulnerable time for pure ALOHA protocol

  • Pure ALOHA (4)The probability that k frames are generated during a given frame time is given by Poisson distribution:So the probability of zero frames is just e-GIn the vulnerable interval, the mean number of frames generated is 2G, so the probability that there is no frame is therefore P0 = e-2GUsing the formula S = G P0, we obtain:The maximum throughput occurs at G = 0.5. For G = 0.5 we get S = 1/2e = 0.184

  • DataLink Layer2-*Slotted ALOHAAssumptionsall frames same sizetime is divided into equal size slots, time to transmit 1 framenodes start to transmit frames only at beginning of slotsnodes are synchronizedif 2 or more nodes transmit in slot, all nodes detect collisionOperationwhen node obtains fresh frame, it transmits in next slotno collision, node can send new frame in next slotif collision, node retransmits frame in each subsequent slot with prob. p until success

    DataLink Layer

  • DataLink Layer2-*Slotted ALOHAProssingle active node can continuously transmit at full rate of channelhighly decentralized: only slots in nodes need to be in syncsimple

    Conscollisions, wasting slotsidle slotsnodes may be able to detect collision in less than time to transmit packetclock synchronization

    DataLink Layer

  • 12.*Figure 12.6 Frames in a slotted ALOHA network

  • 12.*Figure 12.7 Vulnerable time for slotted ALOHA protocol

  • Slotted ALOHAThe time is divided into discrete intervals, each interval corresponding to one frame. The users will need to be synchronized with the beginning of the slot Special station can emit a pip at the start of each intervalA computer is not allowed to send data at any arbitrary times, it will be forced to wait until the next valid time intervalSince the vulnerable period is now halved, the throughput of this method would be:Slotted ALOHA peaks at G=1 :: so S=1/e=.368 (i.e. 37 % success)..a small increase in channel load will drastically reduce its performance.

  • Pure ALOHA vs. Slotted ALOHA Throughput versus offered traffic for ALOHA systems.

  • CSMA Protocols

    Are protocols in which stations listen for a carrier (i.e. transmission) and act accordinglyNetworks based on these protocols can achieve better channel utilization than 1/eProtocols1 persistent CSMANon persistent CSMAp persistent CSMACSMA CD

  • 1 Persistent CSMA1 persistent CSMAWhen a station has data to send, it first listens to the channelIf channel is busy, the station waits until the channel is free. When detects an idle channel, it transmits the frameIf collision occurs, it will wait an random amount of time and starts againThe protocol is called 1 persistent, because the station sends with probability of 1 when finds the channel idle, meaning that is continuously listening Propagation delay

  • Non Persistent CSMABefore sending a station senses the channel. If no activity, it sends its frameIf channel is busy, then will not continue to sense the channel until it becomes idle, but it will retry at a latter time (waiting a random period of time and repeating the algorithm)With this algorithm, fewer collisions will happen; thus better channel utilization but with longer delays than 1 persistent CSMA algorithm

  • 12.*

  • p Persistent CSMAIt applies to slotted channelsWhen a station becomes ready to send, it senses the channel. If it is idle will transmit with a probability of p. With a probability of q it defers to the next slot.If next slot is also idle, it transmits or it defers again with probabilities of p and qThis process is repeated until the frame gets either transmitted or another station it began transmissionFor latter case, the unlucky station acts the same as it would have been a collision (waits a random time and starts again)

  • Persistent and Non-persistent CSMAComparison of the channel utilization versus load for various random access protocols.

  • CSMA with Collision DetectionAn improvement over CSMA protocols is for a station to abort its transmission when it senses a collision. If two stations sense the channel idle and begin transmission at the same time, they will both detect the collision immediately; there is no point in continuing to send their frames, since they will be garbled. Rather than finishing the transmission, they will stop as soon as the collision is detectedSaves time and bandwidth

  • 12.*CSMA/CDCSMA method that weve learnt just now doesnt specify the procedure following a collision. CSMA/CD augments the algorithm to handle the collisionIn the CSMA/CD method, a station monitors the medium after it sends a frame to see of the transmission was a successful. If so, the station is finished. If, however, there is a collision, the frame is sent again.To better understand CSMA/CD, see fig 12.12

  • 12.*Figure 12.12 Collision of the first bit in CSMA/CD

  • 12.*Explanation of CSMA/CD in fig 12.12In the fig, the 1st bits transmitted by the two stations involved in the collision.Although each station continues to send bits in the frame until it detects the collision, it show what happens as the first bits collide. In fig 12.12, station A and C are involved in the collision

  • 12.*At t1, station A starts sending the bits of its frame.At time t2, station C hasnt yet sensed the 1st bit sent by A. it then start sending its bits of frame which propagate both to the left and right.The collision occurs sometime after time t2. station C detects a collision at time t3 when it receives the 1st bit of As frame.Station C immediately abort transmission.Station A detects collision at time t4 when it receives the 1st bit of Cs frame. It also immediately aborts transmission

  • 12.*Minimum frame Size:One of the solution for the case of collision in CSMA/CD method the minimum frame size is determined so that the propagation delay of a frame travel is reduced in order to avoid collision with other frame.Tfr = at least two times TpDiscuss worst case

  • CSMA with Collision DetectionCSMA/CD can be in one of three states: contention, transmission, or idle.

  • 12.*

  • 12.*

  • 12.*CSMA/CAUSED IN WIRELESS (WI-FI and etc.)For this lectures pls refer to chapter 12 of text book. Forouzans. Page 363 - 390

  • Collision Free ProtocolsCollisions adversely affect the system performance, especially if the cable is long and the frames are shortThe collision free protocols solve the contention for the transmission channel without an collisions at allN stations are assumed to be connected to the same transmission channelProtocols Bit-Map ProtocolBinary Countdown

  • Collision-Free Protocols (1)The basic bit-map protocol.If station j has a frame to send, it will transmit a 1 in j-th contention slot

  • Collision-Free Protocols (2)The binary countdown protocol. A dash indicates silence.

  • ReferencesAndrew S. Tanenbaum Computer Networks, ISBN 0-13-066102-3

    ***This presentation deals with broadcast networks and their protocols. **Whenever two frames will try to occupy the channel at the same time, there will be a collision, and both will be garbled. ALOHA is using fixed length frames. **If we are looking at the when a frame can suffer collisions, we can see that there is a vulnerable period of 2 times the frame time. ******The propagation delay has an important effect on the performance of the protocol. There is a small chance that just after a station begins sending, another station will sense the channel and start sending (before the signal from the first one reached it). In this situation a collision can occur. The longer the propagation delay, the more important this effect becomes, and the worse the performance of the protocol. Even if the propagation delay is zero, there will still be collisions imagine two station wanting to transmit data at the same time. But a third one is buy transmitting. Both station will wait until the third will finish is transmission, will sense idle channel and will start sending. *This protocol is widely used CSMA/CD. In particular is the basis for Ethernet LAN. **At the point marked t0, a station has finished transmitting its frame. Any other station having a frame to send may now attempt to do so. If two or more stations decide to transmit simultaneously, there will be a collision. Collision can be detected by looking at the power of the line or at the pulse width of the received signal and comparing it with the transmitted signal. After a station detects a collision, aborts its transmission, waits a random period of time and tries again latter. Therefore the CSMA/CD will consist of alternating contention and transmission periods, with idle periods occurring when all stations are quiet. The minimum time to detect a collision is two times the time it takes the signal to propagate from one station to another. In worst case scenario, the two stations can be at the ends of the cable therefore, the minimum time to detect a collision is the round trip propagation delay for the whole cable segment. The sending station has to monitor the channel for collisions during transmission. Therefore the CSMA/CD is a half duplex system. It is important to realize that the collision detection is an analog process. The stations hardware must listen to the cable while is transmitting. If what it reads back is different than what it sends, then a collision must have had happen. The implication is that the signal encoding must allow collisions to be detected (i.e. a collision of two 0 V signals will never be detected). For this reason, special encoding is used. *Each contention period consists of exact N slots. If station 0 has a frame to send, then it transmits a slot during zero-th contention slot. No other station is allowed to transmit during this slot. Regardless of what station 0 does, station 1 gets the opportunity to transmit a 1 bit during the contention slot 1, but only if it wants to send a frame (has a queued frame). After all N slots have passed, each station has complete knowledge of which stations whish to transmit. Al that point they begin transmitting in numerical order. Since everyone agrees who goes next, there is no collisions. Protocols like this are called RESERVATION PROTOCOLS. *A problem with bit map protocols is that the overhead per station is fixed (on bit), therefore it is not scaling well with large number of stations. In binary countdown protocol, all stations will have same length addresses. A station wanting to use the channel broadcasts its address as a binary bit string, starting with the high order bit. The bits in each address position, from each station are BOOLEAN OR-ed together. This is called binary countdown. All the stations will see the result of the OR operation instantaneously. So an station that placed an 0 on the channel sees a 1, than it will stop trying. A higher priority station wants to transmit therefore it has to stop trying this time. In other words, as soon as a station has seen that a high order bit in its address with value 0 has been overwritten with a 1, it gives up. Consider the stations 0010, 0100, 1001 and 1010 are all trying to get the channel. Station having address 1010 gets the channel (due to the fact that this protocol is giving priority to the stations with higher address).