# A-level Computing/AQA/Paper 2/Fundamentals of communication and networking/Communication
## Specification

* Specification coverage
* 3.9.1 Communication
* 3.9.1.1 Communication methods
* 3.9.1.2 Communication basics

## Introduction

One of the key aspects of computing is communication. For example, input and output devices need to communicate with the processor, the hard disk needs to communicate with memory and so on.
Communication in this sense takes place through the transmission of data and instructions. We have already looked at many examples of data transmission inside the computer. In this section, we are more concerned with communication between computers and peripheral devices and also between one computer and another across local and global networks.
This section will also include a detailed analysis of the infrastructure that makes up the Internet.

## Serial and parallel transmission
### Serial transmission

Serial transmission sends and receives data one bit at a time in sequence. Serial connections are used to connect most of the peripherals to the computer such as the mouse and keyboard, and it is serial cables that connect computers together to form a network.
The speed of the transmission will depend on the type of cabling used so it is not necessarily the case that serial transmission is slow. For example, the Universal Serial Bus (USB) is a high-speed serial connection that allows peripheral devices to be connected to your computer. Serial network cables are capable of transmission rates of 1 Gbps (1000 million bits per second).

### Parallel transmission

Parallel transmission uses a number of wires to send a number of bits simultaneously. The more wires there are, the more data can be sent at any one time. A 32-bit parallel connection, for example, may connect the processor and memory together.
* Exercise: Serial and Parallel Transmission
* What are the advantages of serial data transmission over parallel data transmission?
* Answer:
* it is simpler to set up and requires no synchronising signals
* What is meant by serial transmission of data?
* Answer:
* When data is transmitted bit by bit (or one bit a a time, one after another) over a communication medium like a copper wire
* When is parallel transmission the most appropriate transmission method to use?
* Answer:
* When data is transmitted over a short distance and cost of the transmission medium (wires) is not an issue. With parallel transmission, because more wires are needed, cost can become an issue.
* When is parallel transmission the NOT appropriate even when a parallel port is available?
* Answer:
* When data is transmitted over a very long distance.

## Recap: Comparison of Serial vs Parallel Data Transmission

| Communication Type | Serial | Parallel |
| Speed | Slow - bit by bit | Faster - byte at a time |
| Cost | Low - one wire | higher - > 1 wire required |
| Distance | Long | Short |
| Complexity | simple | more complex - timing signals needed to keep bits syncronised |

## Serial and Parallel Port Plugs

Universal Serial Bus (USB) was designed to standardise the connection of computer peripherals (including keyboards, pointing devices, digital cameras, printers, portable media players, disk drives and network adapters) to personal computers

## Bandwidth

Bandwidth is the term used to describe the amount of data that can be transmitted along a communication channel. It relates to the range of frequencies that are available on the carrier wave that carries the data. The range in this case is the difference between the upper and lower frequencies. As the range of frequencies increases so does the amount of data that can be transmitted within the same time frame. We have already touched on the relative speed at which data can be transmitted. Speed is a vital factor in communications. Bandwidth is measured in hertz (Hz) and megahertz (mHz).

## Bit rate

Bit rate is the term used to describe the speed at which a particular transmission is taking place. It is closely linked to the bandwidth because the bit rate will be limited by how much bandwidth is available.
Bit rate is measured in bits per second (bps). Bandwidth represents the frequencies and therefore the capacity that is available and bit rate represents the actual speed of transfer. The bit rate that can be achieved is directly proportional to bandwidth.

## Baud rate

Baud rate is another term used to describe the speed at which data can be transmitted. One baud represents one electronic state change per second. An electronic state change may be a change in frequency of the carrier wave, a change in voltage, a change in amplitude or a shift of a waveform.
Traditionally, one bit is sent on each state change so one baud is roughly equates to one bit per second. However, it is possible to send more than one bit per state change by using different voltage levels to represent the bits. In this case rather than sending bits, you are sending 'symbols', which may have any number of bits in them. The baud rate is determined by the transmission medium.
| Units | Rates |
| bit = 1 unit of digital data | bit rate = num of bits transmitted in one second |
| baud = unit of signalling speed | baud rate = num of SYMBOLS transmitted in one sec |

## Latency

Latency is the general term used to explain the time delay that occurs when any component within a computer system is responding to an instruction. This is because the instruction is being transmitted down cables, through buses and logic gates, all of which takes time. Therefore, latency can occur at any stage of transmission process. These delays can be so short as to be unnoticeable.
There are three general causes of latency when communicating data:
* Propagation latency: the amount of time it takes for a logic gate within a circuit to transmit the data
* Transmission latency: the amount of time it takes to pass through a particular communication medium; for example, fibre optic would have a lower latency than copper cable
* Processing latency: the amount of time it takes data to pass around a network depending on how servers or devices it has to pass through
To send a single bit of data you will always have a delay caused by latency for the data to travel the physical distance to its destination. Having a 25 Mbps connection does not somehow allow a single bit data of data to travel that a distance any faster. A large bandwidth connection simply allows you to send or receive more data in parallel. The data still needs to travel to and from your computer.

## Questions: Bit rate, bandwidth, baud rate, latency

* Questions: Bit rate, bandwidth, baud rate, latency
* When data is transmitted over long distances latency can become a problem. Explain what latency is.
* Answer:
* Latency is a time delay between the moment that data transmission is initiated and the moment that the effect of data transmission begins;
* What is the relationship between the bandwidth of a transmission medium and the bit rate at which the data can be transmitted?
* Answer:
* The greater the bandwidth, the higher the bit rate. There is a direct proportion between bandwidth and bit rate.
* What is the relationship between the bit rate and the baud rate of a communication system?
* Answer:
* Baud rate is the number of signal changes per second or the rate at which signals can change. As more than one bit can be encoded in
* each signal change bit rate can be HIGHER than baud rate. If the baud rate is S and there are n bits encoded in each symbol change, bit rate is S x n.
* An Arduino board is connected to a computer using a serial connection at a speed of 9600 bits per second and a baud rate of 1200 baud. How it is possible for the number of bits transmitted per second to be higher than the baud rate?
* Answer:
* Because baud rate is a measurement of the number of signal changes in a second and because in each signal (or symbol) more that one bit can be encoded, bit rate is higher that baud rate. In each signal, 8 bits are being transmitted, so that 1200 x 8 = 9600 bits per second can be transmitted.

## Synchronous and asynchronous data transmission
### Synchronous data transmission

Synchronous means that the two devices which are communicating will synchronise their transmission signals. Using the system clock, the computer sending the data will control the transmission rate to be in time with the device or computer receiving the signal. If the two devices are not synchronised then data could be lost during transmission. Once they are synchronised the two devices can send and receive data without need for any further information.

### Asynchronous data transmission

Asynchronous transmission does not require the permanent synchronisation of the sender's and receiver's system clocks. Instead, it synchronises only for the duration of the transmission by sending additional bits of information called start and stop bits.
To send a character may require an 8-bit code to be transmitted. In addition to the eight bits, asynchronous data transmission requires at least two other bits. At the start of the eight bits there is a start bit and at the end, a stop bit. The character may also include a parity bit
The process works as follows:
* The start bit causes the receiver to synchronise its clock to the same rate as the sender
* Both devices must already have agreed on how many bits of data will follow (commonly 7 or 8 bits), whether a parity bit is being used, what type of parity it is, and how many stop bits there will be
* The stop bit (or bits) indicate that the data has arrived so the processor on the receiver's device can now handle those bits, for example, by copying them into memory
* If there is more data then another start bit will be sent and the cycle will continue
* The sender's device sends data as soon as it is available rather than waiting for the clock pulse or a synchronisation signal from receiving device.

### Advantages and disadvantages

| Transmission | Advantages | Disadvantages |
| Asynchronous transmission | Simple, doesn't require synchronisation of both communication sides Cheap, because asynchronous transmission requires less hardware Setup is faster than other transmissions, so well suited for applications where messages are generated at irregular intervals, for example data entry from the keyboard, and the speed depends on different applications. | Lower overhead and thus, greater throughput |
| Synchronous transmission | Large relative overhead, a high proportion of the transmitted bits are uniquely for control purposes and thus carry no useful information | Slightly more complex Hardware is more expensive |

### Which method is more suitable when?
## Synchronous

* This method of transmission is used when large amounts of data need to be transferred quickly since data is transferred in large blocks instead of individual characters.
* The data blocks are spaced and grouped in regular intervals and preceded by synchronous characters that a remote device decode and use to synchronise the connection between the end points.
* e.g. VoIP

## Asynchronous

* The asynchronous transmission method is deployed when data is sent as packets as opposed to in a solid stream
* Asynchronous is sometimes called "best effort" transmission because one side simply transmits, and the other does it's best to receive and any lost data is recovered by a higher level protocol.
* e.g. HTTP

## Protocols

Protocols are a method for ensuring that different computers can communicate with each other. A protocol is a set of rules. In the context of communication, there are a number of rules that have been established in relation to the transmission of data. Protocols cover aspects such as the format in which data should be transmitted and how items of data are identified.
From using the Internet, you will probably already have comes across four common protocols:
| Protocol | Purpose |
| TCP/IP (Transmission Control Protocol/Internet Protocol) | two protocols that are usually referred to as one and relate to the set of rules that govern the transmission of data around the Internet are split into packets. TCP/IP handles the routing and re-assembly of these data packets. |
| HTTP (Hypertext Transfer Protocol) | you may have seen HTTP in that it provides the rules governing the exchange of different types of file that make up displayable web pages |
| FTP (File Transfer Protocol) | FTP is similar to HTTP in that it provides the rules for the transfer of files on the Internet. FTP is commonly used when downloading program files or when you create a web page and upload to the ISP's server. |
| VoIP (Voice over Internet Protocol) | group of technologies for the delivery of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet |

### Questions: Asynchronous and Synchronous transmission

* Exercise: Async vs Sync transmission
* What is synchronous data transmission?
* Answer:
* This is when the sender and receiver in the transmission of data stay in step the whole time. It requires that the transmitter send a synchronisation signal periodically.
* When characters are sent using asynchronous data transmission is used, one character is sent at a time. One start bit marks the beginning of a character and one stop bit marks the end of a character. Give an example of a start and stop bit combination
* Answer:
* The start bit could be a 0 and the stop bit a 1 (or the other way around) - they must be different
* What type of transmission is usually used in packet switched networks?
* Answer:
* The asynchronous transmission method is deployed when data is sent as packets as opposed to in a
* solid stream

## Summary

* Serial transmission sends data one bit at a time
* Parallel transmission sends data several bits at a time
* Bandwidth is a measure of the physical capacity of communication channel
* Bit rate and baud rate are methods for quantifying how much data can actually be transmitted within a certain time frame
* Latency is the delay that occurs when data is being transmitted
* Synchronous data transmission takes place between devices that have synchronised their clocks
* Asynchronous transmission does not require devices to be synchronised, instead it sends extra bits of data (start and stop bits)
* Protocols are the rules that define how transmission will take place