330 likes | 345 Views
Week3 The Medium Access Sublayer. Multiple Access Protocols. Overal Internet Architecture. MAC Sublayer. MAC Architecture. Broadcast through a Single Channel. Determining who will use the channel next is a problem Medium Access Control (MAC) sublayer solves this problem
E N D
Week3The Medium Access Sublayer Multiple Access Protocols
Computer Networks 1 Broadcast through a Single Channel • Determining who will use the channel next is a problem • Medium Access Control (MAC) sublayer solves this problem • MAC is a sublayer (bottom part) of data link layer • Broadcast Channels, also called • Multiaccess Channels • Random Access Channels
Static Channel Allocation • Usually done by FDM or TDM • Not an efficient method for data traffic: • Let • The capacity of a channel be C bps • The mean time delay of the channel be T (seconds) • Frame arrival rate is a random variable from Poisson distribution with mean frames/second • Frame length is a random variable from exponential probability density function with mean 1/ bits/frame • Then • T = 1 / (C - ) (result from queuing theory) • Now, let the channel be divided into N subchannels with capacity C/N and mean input rate /N • TFDM= 1 / ((C/N) – (/N) = N / (C - ) = NT • This means that he average delay is N times worsened
Dynamic Channel Allocation Assumptions 1 • Station Model: block and wait • Generates frames at a rate of frames/unit time (Frame generation is Poisson Distribution) • Once a frame is generated, the station is blocked until the frame is successfully transmitted • Single Channel Assumption: equal rights • All stations transmit and receive with equal priority over a unique channel
Dynamic Channel Allocation Assumptions 2 • Collision Assumption • Overlapping transmission by two or more stations at the same time garbles the frames (collision) • All stations detect collisions • There are no errors other than those generated by collisions • Continuous Time • Frame transmission can begin at any instant of time • Slotted Time • Time is divided into very narrow time slots • Frame transmission always begins with a slot
Dynamic Channel Allocation Assumptions 3 • Carrier Sense • Stations can detect if the channel is in use • LANs generally have carrier sense • No Carrier Sense • Stations can not sense the channel before trying to use it • Satellite networks do not have carrier sense
Pure ALOHA • Users transmit any time • If there is a collision • sender knows about it after a certain time, • waits random amount of time, • sends the frame again • Contention systems • Systems in which multiple users share a common channel in a way that can lead to conflicts • To maximize throughput, frames must have uniform sizes
ALOHA Assumptions • Frame time=time to transmit one frame • Number of frames generated in a frame time is a Poisson Distribution with mean N. • If N>1, every frame will suffer a collision • 0<N<1 is reasonable • Probability of k transmission attempts in a frame time is Poisson with parameter G. Pr[k]=Gk e-G/k! • For small N, G N • For large N, G>N
Efficiency of ALOHA • Referring to the figure on prev. page, the vulnerable period is two frame times • The probability that no frame is transmitted during this period is e-2G • Pr[0]=e-G in one frame period so P0=e-2G in two frame periods • Therefore troughput S = G e-2G • The maximum of S occurs at G=0.5, S=1/2e
Carrier Sense Multiple Access (CSMA) Protocols • ALOHA does not listen to the channel before it transmits, ending up with poor performance • Carrier Sense Protocols • Stations listen the channel if there is any transmission going on before they transmit
Persistent and Nonpersistent CSMA • 1-persistent CSMA • Stations transmit with probability 1 whenever they find the channel idle • Nonpersistent CSMA • If the channel is idle before the first attempt, transmit • If the channel is already in use, wait for a random amount of time, and then listen to the channel for transmission • P-persistent CSMA • Applies to slotted channels • If the channel is idle, • transmit with probability p • Defer transmission until the next slot with probability q = 1 – p • If, in the mean time, someone else transmits, wait a random time • If channel busy • Wait for the next slot
CSMA with Collision Detection (CSMA/CD) • collision Detection • Abort transmission as soon as detect collision • If is the time the signal propagates between two farthest stations, the station has to wait 2 to make sure that no collision has occurred • CSMA/CD model has contention, transmission and idle periods • Contention period is modeled as a slotted ALOHA with slot size 2
Collision-Free Protocols • Assumptions • There are N stations • Each station has a unique address (0 to N-1) hardwired to it • Question • Which station gets the channel after a successful transmission?
A Bit-Map Protocol (Reservation Protocol) • Two rounds of transmission cycle • First Round (Contention Period) • Consists of N slots each reserved for a particular station • In this period, each station transmits • 1 if it has a frame to transmit • 0 if it has no frame to transmit • At the completion of the first round everybody knows who wants to transmit • Second Round (Transmission Period) • Stations transmit according to the order formed in the first round • There will not be any collisions
Reservation Protocol Performance :Binary Countdown • Each station has a binary station address • A station wanting to transmit broadcasts its address starting with the high-order bit • The bits from each station are boolean Or’ed • Arbitration Rule • As soon as a station sees that a high-order bit position that is 0 in its address is overwritten by 1, it gives up • Channel Efficiency is d/(d+log2N) • If station address is the first field in the frame then efficiency is 100%.
5: DataLink Layer Some terminology: hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links wired links wireless links LANs layer-2 packet is a frame,encapsulates datagram Link Layer Services data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5: DataLink Layer Link Layer Services • framing, link access: • encapsulate datagram into frame, adding header, trailer • channel access if shared medium • “MAC” addresses used in frame headers to identify source, dest • different from IP address! • reliable delivery between adjacent nodes • we learned how to do this already (chapter 3)! • seldom used on low bit-error link (fiber, some twisted pair) • wireless links: high error rates • Q: why both link-level and end-end reliability?
5: DataLink Layer Link Layer Services (more) • flow control: • pacing between adjacent sending and receiving nodes • error detection: • errors caused by signal attenuation, noise. • receiver detects presence of errors: • signals sender for retransmission or drops frame • error correction: • receiver identifies and corrects bit error(s) without resorting to retransmission • half-duplex and full-duplex • with half duplex, nodes at both ends of link can transmit, but not at same time
Link Layer (Ethernet) Frames IEEE Standard 802.3 and Ethernet Ethernet Frame Structure (Ethernet Encapsulation) 7 1 6 6 2 4 preamble SFD DA SA type Data CRC 60 to 1514 bytes synchronize the receiver type Cyclic Redundancy Check 0800: IPv4 datagram 0806: ARP request/reply 8035: RARP request/reply 86DD: IPv6 start frame delimiter
Ethernet Frame (cont’d) • 2 byte type that indicates what kind of data follows, e.g., 0800 for an IP packet • Then the data, maximum 1500 bytes, minimum 46 bytes • Data field must be padded with extra bytes if fewer than 46 bytes are supplied