Making Connections © Prof. Aiman Hanna Department of Computer Science Concordia University Montreal, Canada C ommunication Carriers & Devices The Telephone Network Connects 100s of millions of users Calls are routed first to the local office (local exchange or central office) Calls within the same area code can be made through direct connections Other calls are routed depending on the destination Private Branch Exchange (PBX) computer is used to route telephone calls within a company or organization Figure 4.2 – Telephone Network 2 C ommunication Carriers & Devices Cellular Phones A geographic region is divided into cells each with a base station. A cellular phone is a two-way radio capable of communicating with the base station The cell phone may be within more than one boundary, however it communicates with the base station from where the signal is stronger Base stations communicate with a MTSO (Mobile Telephone Switching Office), which connects to the regular telephone network Receiving a cell call is more complex 3 C ommunication Carriers & Devices Cellular Phones Figure 4.3 – Cellular Grid 4 C ommunication Carriers & Devices Cellular Phones Figure 4.4 – Cellular Phone Communication 5 C ommunication Carriers & Devices Facsimile (Fax) Machines A paper sheet is divided into a dot matrix; each dot (Pixel) is so tiny (200 dots per inch, 40,000 dots per square inch) Each dot is a bit: 1 if dot is white, 0 if black 8.5x11 inches paper would produce 3,740,000 dots, and it takes 2 minutes (approx.) at the rate of 33.6 bps Fax machines use Data Compression schemes; instead of sending dot by dot, the fax groups the dots and defines binary representation of them using fewer bits 6 T ransmission Modes Defines the way in which a bit group travels from device to another Also defines whether bits travel in both directions simultaneously or must take turns Different transmission modes exist: • Serial & Parallel • Asynchronous, Synchronous & Isochronous • Simplex, Half-Duplex & Full-Duplex 7 T ransmission Modes (continue...) Serial & Parallel Transmission Parallel transmission sends bits of a byte simultaneously on separate wires; used between PC and printer Only recommended for short distances due to sync problems Serial transmission uses one wire, and can be used for long distance communication; cheaper, more reliable but slower Figure 4.7 – Parallel & Serial transmission 8 T ransmission Modes (continue...) Asynchronous, Synchronous & Isochronous Transmission These are ways to provide serial communication Asynchronous transmission: • • • • Bits are divided into small groups, usually bytes, and sent independently The receiver never knows when the bits will arrive For example, typing keyboard characters Typical byte-oriented input-output; that is data is transmitted one byte at a time • A start bit is needed to alert the receive that some data is coming; otherwise the first few bit may get lost by the time the receiver detect and reacts to data reception • Similarly, a stop bit is needed 9 T ransmission Modes (continue...) Asynchronous, Synchronous & Isochronous Transmission Figure 4.8 – Asynchronous Communication Overhead is 2/8 = 25% Figure 4.9 – Asynchronous Transmission of ASCII Digits 321 using NRZ Coding 10 T ransmission Modes (continue...) Asynchronous, Synchronous & Isochronous Transmission Synchronous transmission: • Allows transmission of larger bit groups • Characters are grouped into a Data Frame (simply Frame) them be transmitted as a whole • A generic data frame has the following pieces: SYN: unique bit pattern that alert the receiver of frame arrival • Also used to ensure the receiver’s sampling rate and the consistency of the arrival rate • The receiver can then synchronize itself to the rate at which bits arrive Control: these bits may include the following elements • Source address • Destination address: Needed if frame needs to go through different nodes before reaching the destination Data: Actual number of data bytes Sequence Number: Used to assemble frames at the destination in case they arrive out of order Frame Type: Distinguished by some protocols Error: Error checking bits End: End-of-frame bits 11 T ransmission Modes (continue...) Asynchronous, Synchronous & Isochronous Transmission Synchronous transmission: • Much faster and has small overhead, however • Larger frames require higher buffering; they may also occupy the link for longer time Figure 4.10 – Synchronous Transmission Frame 12 T ransmission Modes (continue...) Asynchronous, Synchronous & Isochronous Transmission Isochronous transmission: • With asynchronous & synchronous data do not necessarily arrive at a fixed rate • Time between different synchronous frames may vary (asynchronous nature!) • Errors may force the frame to be reset, which affects the transfer rate further • For some applications, such as file transfer, that is fine since correct information is more important than delays • Isochronous transmission is used to ensure a fixed transmission rate without gaps in between 13 T ransmission Modes (continue...) Simplex, Half-Duplex & Full-Duplex Communication Figure 4.11 – Simplex, Half-Duplex & Full-Duplex communication 14 I nterface Standard Communication may not occur even if both parties are using the same mechanisms! For example, if both send at the same time, no information may reach any of them – if one is not ready to listen then information is also lost Hence, communication must be guided by protocols Data Terminal Equipment (DTE), such as PCs, do not communicate directly; rather they communicate to Data Communication Equipment (DCE), such as a modem, which connect to the network The connection between DTE & DCE is called DTE-DCE Interface Figure 4.12 – DTE-DCE Interface 15 I nterface Standard (continue...) EIA-232 Interface (RS-25 Serial Port) RS232: 25-line cable with 25-pin connector (DB25). Every line has a function; for example: • Pin 1: protective ground • Pin 2: Transmit date DTE DCE • Pin 22: Ring Indicator; indicates DCE is receiving a ringing signal (when modem receives a call) RS-232 Connector 16 I nterface Standard (continue...) EIA-232 Interface (RS-232 Serial Port) Figure 4.14 – Sending & Receiving over RS-232 17 I nterface Standard (continue...) EIA-232 Subset Driven by economics and actual user needs, some vendors only implemented a part of the interface using only 9 circuits instead of 25 (9-bin connectors) RS-232 Subset – 9-bin Connector 18 I nterface Standard (continue...) Null Modem Sometimes, it is needed to connect two computers directly A first attempt to establish connection is plug in the wire to both ends This however won’t work; Why? Same circuit in each end is expected to perform the same functionality; for example send/send or receive/receive One solution in such case is to use a null modem The null modem can be simply a cable Figure 4.15 – Null Modem 19 I nterface Standard (continue...) X.21 Interface Uses 15-bin interface Defined as a digital signaling interface Control information are changed in a different way than RS-25 The standard requires more logic circuits (intelligence) in the DTE & DCE that can interpret control sequence & reduce the number of connecting circuits C (control) & I (indication) state info T (transmit) & R (receive) data or control info 20 I nterface Standard (continue...) X.21 Interface Figure 4.16 – Sending & Receiving over an X.21 Connection 21 I nterface Standard (continue...) Universal Serial Bus (USB) Not long ago, we had to deal with Serial ports, Parallel ports, Special connections for Game controllers, Key-boards, Mice, etc. USB was the proper replacements to those many connectors Very flexible in connecting many different devices Has 7-bit addressing schemes to reference the devices, which enables connections to 127 (excluding the DTE host itself) 22 I nterface Standard (continue...) Universal Serial Bus (USB) Figure 4.17 – Connecting USB Devices 23 I nterface Standard Universal Serial Bus (USB) USB cable contains 4 wires: 2 wires for data carrying signal in modified NRZ (0 changing, 1 same) The other two wires provide low-amplitude power source to USB devices USB 1.1 at 12 Mbps, USB 2.0 at 480 Mbps. Limited to 4.5 meters; if longer, there is no guarantee of electrical signal integrity (continue...) Figure 4.18 – USB Wires Figure 4.19 – USB Cable & Plugs 24 I nterface Standard (continue...) Universal Serial Bus (USB) Operates on Master/Slave mode, where the host is the master USB Frame: 1-milisecond slice of time. During this 1-ms time frame, packets are sent (packet is a group of bits) All devices are clock synchronized in respect to a frame The synchronization is not done by a common clock; rather by the host sending a special packet at the beginning of each frame This special packet indicates that a new frame is beginning 25 I nterface Standard (continue...) Universal Serial Bus (USB) USB defines 4 different transmission types: • • • • Control Transfer Bulk Transfer Interrupt Transfer Isochronous Transfer Control Transfer: • • • • USB devices are hot pluggable Once plugged, the host queries the device to determine its type & bit rate The devices responds the host assigns an address to that device Once this is done, the device is connected and can receive commands from the host such as requesting their status or initiating data exchange 26 I nterface Standard (continue...) Universal Serial Bus (USB) Bulk Transfer: • Some USB devices, such as scanners & digital cameras, transfer large amount of data (bulk transfer) • Error detection is performed and the packet may have to be resent • Reliable transfer, but no guarantee of timely transfer • Many devices might be doing bulk transfer at the same time, which may result in errors/retransmission hence, no guarantee on delivery time 27 I nterface Standard (continue...) Universal Serial Bus (USB) Interrupt Transfer: • The world interrupt here is not that proper! • USB devices hold the information until the host asks for them, which is literally Polling • The major advantage here is avoiding the complexity involved with the interrupt system/protocol • For example, if the host sets its polling time to the keyboard at 50 frames (each 50 ms), then it can get up to 20 characters each second 28 I nterface Standard (continue...) Universal Serial Bus (USB) Isochronous Transfer: • For some real-time devices, such as microphones and speakers, steady transfer rate is significant • The host can guarantee data rate for those devices by reserving a part of each frame for them • As with most real-time systems, error detections do not occur here; it is simply not needed 29 I nterface Standard (continue...) Universal Serial Bus (USB) USB Packets • Several exchange of packets could take place during a single frame • Packet types: Token, Data, Handshake • All packets have SYN and PID (packet ID) • SYN is a bit pattern that forces the receiving device to synchronize its clock with the sender and adjust their receiving bit rate • PID identifies the packet type • SOF indicates the Start o Frame 30 I nterface Standard (continue...) Universal Serial Bus (USB) USB Packets • IN & OUT packets represent a request from the host to initiate data transfer • Address is a 7-bit address that identifies the device to be used • CRC (Cyclic Redundancy Check) is used for error detection • If errors occur, a NAK is sent to the host • Some devices may have more than one address; for example a game controller with multiple buttons would have multiple addresses associated with them. The endpoint is needed to identify the exact source or destination of the data within the device. • For example, a game controller may have many buttons sending or receiving different information. Each of these buttons will be indicated by an endpoint 31 I nterface Standard (continue...) Universal Serial Bus (USB) USB Packets Figure 4.20 – USB Frames & Packets 32 I nterface Standard (continue...) FireWire FireWire (Apple), i.Link (Sony) Share common characteristics with USB Provide a speed of 400Mbps (USB provides 12Mbps, USB 2.0 provides 480 Mbps Can be used with many devices, but the main focus is on multimedia devices, especially with digital video application Connects multiple devices using Daisy Chain, which means many devices can be connected in sequence and there is no need for a hub Devices have one or more FireWire port, so they can also act as regenerators/repeaters 33 I nterface Standard (continue...) FireWire Figure 4.21 – Connecting FireWire Devices 34 I nterface Standard (continue...) FireWire Uses 6 wires (2 twisted pairs TPA & TPB + 2 wires for power source) Uses Data Strobe Encoding • TPA uses some form of NRZ, where 1 is high, 0 is low • This is however error-prone due to mis-synchronization with the sender clock • The sender sends a strobe signal over TPB, which stays constant whenever the data change from 1 to 0 and vise versa • The receiver gets both TPA & TPB signals and by XORing them, it can create the exact sender clock • This is a bit like Manchester Encoding, with one great difference; the baud rate is the same as the bit rate, so there is no double BW utilization • The only cost here is one additional twisted pair 35 I nterface Standard (continue...) FireWire Figure 4.22 – Data Strobe Encoding 36 I nterface Standard (continue...) Multiple FireWire Buses USB uses Master/Slave protocol whereas FireWire uses peer-topeer protocol Devices may be daisy chained together to form a bus group Figure 4.23 – Multiple FireWire Buses 37 I nterface Standard (continue...) Multiple FireWire Buses FireWire supports two communication modes: Asynchronous, Isochronous Asynchronous Communication: • Involves exchange & acknowledgment • Send a packet Wait for a ACK or NACK Isochronous Transfer: • With this mode, FireWire guarantee that data is sent at a steady rate; there is no waiting for ACKs or resending of packets 38 I nterface Standard (continue...) FireWire Arbitration Since there is no master host, what happens if two devices attempt to send at the same time Devices are configured in a tree hierarchy, with one device at the root; each device selects an ID based on its location in the tree The root device acts an arbiter; when devices under it wish to transfer, the root decides which one gets the bus based on some form of priority This process is only part of the arbitration, and it works with some arbitration methods: • Fairness Arbitration, and • Urgent Arbitration 39 I nterface Standard (continue...) FireWire Arbitration Fairness arbitration: Fairness interval allows all competing devices to access the bus once. No device monopolizes the bus; the fairness interval starts again after all devices that wish to send use the bus once Urgent arbitration allows the devices to be prioritized within a fairness interval (asynchronous packets interval) Root device has the highest priority among all in the group To guarantee Isochronous transmission, the root device acts as a Cycle master. Each cycle starts with a cycle-start-packet, which marks the start of an Isochronous cycle Starting the Isochronous cycle regularly guarantees Isochronous transmission 40 I nterface Standard (continue...) FireWire Arbitration Figure 4.23 – FireWire Arbitration 41 M ultiplexing It is possible to connect each device of a network directly to that network, however each of these connection carries its cost Alternatively, multiplexing can be used A multiplexer, or mux, routes transmission from multiple sources to a single destination Multiplexer 42 M ultiplexing (continue...) Frequency-Division Multiplexing (FDM) Used with analog signals; a common uses are TV & radio The available BW is divided into separate ranges or channels Each device shares a part of the available BW, a channel, and keeps that portion at all times Figure 4.27 – Amplitude Modulation 43 M ultiplexing (continue...) Frequency-Division Multiplexing The modulated signals from all inputs are combined into as a single, more complex analog signal The channels themselves are separated by a guard band Figure 4.29 – FDM 44 M ultiplexing (continue...) Time-Division Multiplexing (TDM) Used with digital signals TDM keeps the signals physically distinct but logically packages them together The optimal performance is achieved when the combined input rate is equal to the output rate A faster combined input rate would result in signals being dropped and a slower input rate would results in frames that are partially full so the channels are underused Figure 4.30 – TDM 45 M ultiplexing (continue...) Statistical Time-Division Multiplexing In practice, it may not be possible to keep input & output rates the same Keeping the frame size fixed would simply the protocol but underutilize the channels An alternative is to use Statistical Multiplexer, sometimes called Concentrator Since the order in one frame is not the guaranteed, a more complex logic is there to resolve the frame correctly Figure 4.31 – Statistical TDM 46 M ultiplexing Wave-Division Multiplexing Similar to FDM, but based on optics – Potential bit rate is 1000 Gbps (Tera bps) Light consists of several wavelengths (refer to spectrum of frequencies) Prism spreads the light into different colors (to different wavelengths) Each source can operate at a specific wavelength All signals are combined before transmission, and separated at the receiver (continue...) Figure 4.32 – Light Reflecting through a Prism Figure 4.33 – Wave-Division Multiplexing 47 D igital Carriers T1 A standard used for long-distance communication Uses TDM to combine many voice channels into one DS1 frame T1 refers to the circuit, DS1 refers to the signal DS1 frame has 24 channels of 8 bits each, and one framing bit for synchronization Figure 4.34 – DS1 Frame 48 D igital Carriers (continue...) T1 8-bit voice samples are taken from each of the 24 channels at a rate of 8000 samples per second Each sample occupies one slot in the DS1 frame The receiving mux extract the bits from each slot and route them to the appropriate destination (the voice is heard at the other side) Figure 4.34 – T1 Carrier System 49 D igital Carriers T1 (continue...) T1 rate: • 8-bit sample * 8000 samples/second 64 Kbps • To support this rate, T1 must transmit a DS1 frame each 1/8000 seconds must transmit 8000 * 193 bits each second • Date rate of 1.544 Mbps This rate is considered slow compared to optical fiber capabilities That is the reason there are other carriers with more channels and faster bit rate T1 is not only used for voice communication; other companies lease phone lines to transfer digital information between computers Carrier Digital Signal No. No. of Channels Bit Rate, Mbps T1 DS1 24 1.544 T2 DS2 96 6.312 T3 DS3 672 44.736 T4 DS4 4,032 274.176 North American Communication Carriers 50 C ontention Protocols Access to the medium from many entry points is called contention Unless controlled, contention may lead to fatal problems Contention protocols are used to avoid such problems Figure 4.39 – No Contention Protocol Figure 4.40 – Stop-and-Go Access Protocol 51 C ontention Protocols (continue...) Aloha Protocols Earliest contention protocol in 1970s by Univ. of Hawaii, called Pure ALOHA Several stations to central station (Menehune) by radio communication f1 for broadcast, f2 (different frequency than f1) for ACK Any station can transmit; if collision then wait random time Figure 4.41 – Aloha System 52 C ontention Protocols (continue...) Slotted Aloha Protocols Any overlap in signals, even a small one, would force retransmission Hence, a minimal safe period to transmit two signals is 2T (T is time period) So, to allow a device to transmit, you should reserve 2T for that Not to waste such time, Slotted Aloha is used Devices can only send at the beginning of each slot Figure 4.42 – Transmission Using Pure Aloha & Slotted Aloha 53 C ontention Protocols (continue...) Slotted Aloha Protocols Slotted Aloha has a higher success rate than Pure Aloha However, with increased traffic, the different may not be that significant Figure 4.43 – Success Rate for Pure Aloha & Slotted Aloha 54 C ontention Protocols (continue...) Carrier Sense Multiple Access Protocols (CSMA) Sense the medium at the beginning of a slot, send if the medium is free, else wait for next slot p-persistent CSMA: • • Continue to sense the active medium If free, send with a probability p (0 < p 1) p=0 never transmits (wait again) ; p=1 always transmits (collision chances are higher) Nonpersistent CSMA: check periodically, if free send else wait for one time slot and check again Figure 4.44 – Success Rate for CSMA & Aloha Protocols 55 C ontention Protocols (continue...) Collision Detection (CD) Instead of sending entire frame then discover that collision has occurred when no ack is received, sense the medium for collision and stop transmitting if occurs This will avoid the medium from being unusable during collision Commonly used with CSMA – called CSMA/CD Figure 4.45 – Collision with and without Detection 56 C ontention Protocols (continue...) Collision Detection (CD) Two issues worth considering: • Frame size • Distance Frame Size: • The frame has to be of a minimum size so the device can detect collision before it finishes • If too large, a device can monopolize the medium • So, how small should a frame be? Depends on the maximum time it takes to detect collision 57 C ontention Protocols (continue...) Collision Detection (CD) Example: Assume: • 10 Mbps bit rate, • Largest distance between two devices is 2 KM • Signal propagate at a rate of 200 meter/µsec To propagate 2 KM it takes 10 µsec To propagate 4 KM (worst case, go & come back), we need 20 µsec Rate of 10 Mbps is the same as 10 bits each µsec In 20 µsec we have 200 bits or 200/8 = 25 bytes • This is the minimum size a frame can be so CD can be made 58 C ontention Protocols (continue...) Collision Detection (CD) The other issue with CD is distance For example CD does not work well with satellite since the time needed to travel back and forth between ground and satellite is too big due to the large distance Binary exponential back-off algorithm Varies the waiting time before sending again if collision occurred If first collision then wait 0, or 1 slots Second collision then wait randomly for 0, 1, 2, or 3 slots ..........................… ………………….. If n successive collisions then wait for random # of slots between 0 and 2n-1, when n > 16 give-up and signal to higher layer! 59 C ontention Protocols (continue...) Token Passing Instead of sending whenever it wishes, a device will take turns in sending with the other ones Capture token to send data frame If data then remove token and transmit data frame; else pass token to neighbor Only sender can put the token back on ring after receiving it back One frame per token Advantage: contention is much controlled than the previous protocols Disadvantages: • All devices must be known • Complexity (what happen if the token is lost or if the device that has control over it fails) 60 C ontention Protocols (continue...) Token Passing Figure 4.46 – Token Ring Network 61