Syllabus coverage
- Understand that data is broken down into packets to be transmitted and describe the structure of a packet
- Describe the process of packet switching
- Describe how data is transmitted from one device to another using different methods of data transmission, including serial, parallel, simplex, half-duplex and full-duplex, including the advantages and disadvantages of each method
- Explain the suitability of each method of data transmission for a given scenario
- Understand the universal serial bus (USB) interface and explain how it is used to transmit data, including the benefits and drawbacks of the interface
- Understand the need to check for errors after data transmission and how these errors can occur, for example data loss, data gain and data change caused by interference
- Describe the processes involved in each of the following error detection methods for detecting errors in data after transmission: parity check (odd and even), including parity byte and parity block check, checksum and echo check
- Describe how a check digit is used to detect errors in data entry and identify examples of when a check digit is used, including international standard book numbers (ISBN) and bar codes
- Describe how an automatic repeat query (ARQ) can be used to establish that data is received without error, including the use of positive and negative acknowledgements and timeout
- Understand the need for and purpose of encryption when transmitting data
- Understand how data is encrypted using symmetric and asymmetric encryption, including the use of public and private keys
Part of the IGCSE Computer Science syllabus 0478.
Data packets and the structure of a packet
Data sent across a network is not sent as one long stream. It is broken down into packets, which are small chunks of data that are sent independently of one another. Packets are used because a large file sent as a single block would occupy the whole connection until it had finished, and because if something went wrong the entire file would have to be sent again. With packets, many users can share the same network at the same time, and a single packet that goes missing can be re-sent on its own.
Every packet has three parts: a packet header, the payload and a trailer. The payload is the actual data being transmitted, for example part of a photograph. The header carries the information needed to get the packet to the right place and to put it back in order at the other end. The trailer usually contains a method of checking for errors, such as a checksum, so that the receiving device can tell whether the packet arrived correctly.
The packet header contains the destination address, so that the routers in the network know where the packet is going; the packet number, so that the packets can be reordered correctly once they arrive; and the originator's address, so that the receiving device knows where the packet came from and where to send an acknowledgement.
| Part of the packet | What it contains | Why it is needed |
|---|---|---|
| Packet header | Destination address, packet number, originator's address | So the packet can be routed to the correct device and put back into the correct order |
| Payload | The actual data being transmitted, such as part of a file | This is the information the user wants to send |
| Trailer | A method of checking for errors, such as a checksum | So the receiving device can check that the packet arrived without errors |
Packet switching
Packet switching is the process used to send packets across a network. Each packet is sent separately, and each packet can take a different route to the destination. A router is the device that controls the route a packet takes, choosing the best route available at that moment depending on how busy each connection is and whether any of them have failed.
Because the packets travel independently, they may arrive out of order. Once the last packet has arrived, the receiving device uses the packet numbers in the headers to reorder the packets back into the correct sequence and rebuild the original data. If a packet never arrives at all, the receiving device can ask for it again, so only that one packet has to be re-sent rather than the whole file.
Packet switching makes very efficient use of a network. Routes are shared between many users at the same time, and if one route fails the packets simply take another. The cost is the extra work at each end in numbering the packets, routing them, checking them and putting them back in order.
- Data is broken down into packets before it is transmitted.
- Each packet can take a different route to the destination.
- A router controls the route that a packet takes.
- Packets may arrive out of order, and they are reordered once the last packet has arrived.
Serial and parallel transmission
Serial transmission sends the bits one at a time, one after another, along a single wire or channel. Parallel transmission sends several bits at the same time, one bit down each of several wires. Parallel is faster for the same clock speed because more bits arrive in each clock cycle, which is why it was used for short connections such as an old printer cable.
Over any distance, though, parallel transmission has a serious problem. The bits travelling along the different wires can become skewed, so bits that were sent at the same moment arrive at slightly different times and the receiving device reads them in the wrong order. A cable containing several wires is also more affected by interference. Serial transmission does not have this problem, because there is only one stream of bits to keep in step, so it is reliable over long distances and the cable is cheaper.
Serial transmission is slower than parallel if you compare one wire with several, but modern serial connections run at very high speeds, and most cables and networks you meet now use serial transmission. In short: parallel for short distances where speed matters, serial for long distances where reliability matters.
| Method | How it works | Advantages | Disadvantages |
|---|---|---|---|
| Serial | Bits are sent one at a time down a single wire | Reliable over long distances; only one wire is needed so it is cheaper; the bits cannot become skewed | Slower than parallel for the same clock speed |
| Parallel | Several bits are sent at the same time, one down each wire | Faster than serial for the same clock speed, so it suits short distances | The bits can become skewed over distance so the data is read incorrectly; a multi-wire cable is more expensive; more affected by interference |
Simplex, half-duplex and full-duplex
The direction in which data can travel is called the transmission mode. In simplex transmission data travels in one direction only: the sending device can only send and the receiving device can only receive. A keyboard sending data to a computer, or a computer sending data to a monitor, is simplex.
In half-duplex transmission data can travel in both directions, but not at the same time. One device sends while the other listens, and then they swap over. A walkie-talkie works this way, which is why you say 'over' before the other person speaks. The advantage is that one channel is used in both directions; the disadvantage is the delay while the direction of transmission is changed.
In full-duplex transmission data can travel in both directions at the same time. A telephone call is the classic example, because both people can speak and listen at once. Full-duplex makes the best use of a connection because no time is wasted waiting for the direction to change, but the connection must be able to carry data both ways at once.
| Mode | Direction of data | Example | Advantage and disadvantage |
|---|---|---|---|
| Simplex | One direction only | Keyboard to computer, computer to monitor | Simple and cheap, but data can never be sent back |
| Half-duplex | Both directions, but only one at a time | Walkie-talkie | One channel is used both ways, but there is a delay while the direction is changed |
| Full-duplex | Both directions at the same time | Telephone call | Fastest, because no time is wasted changing direction, but the connection must carry data both ways at once |
USB: the universal serial bus
USB (universal serial bus) is a standard interface used to connect devices to a computer and to transmit data between them. It uses serial transmission, sending the bits one at a time along the cable. A USB connection can also supply power to the device, which is why so many devices can be charged from a USB port.
The word 'universal' is the whole point. Because USB is a standard, the same type of port and cable is used by many different manufacturers, so a device works with almost any computer without a special adapter. It is plug and play, meaning the computer recognises the device when it is plugged in and installs the driver automatically with no setup. It is also hot-swappable, meaning a device can be connected or disconnected while the computer is running, without restarting it. Several devices can be connected at the same time by using a USB hub.
The drawbacks are that the length of a USB cable is limited, so it cannot be used to connect a device that is far away, and the transfer speed depends on which version of USB the device and the port support, so an older device connected to a newer port will not run at the full speed.
- USB is a standard interface, so devices from different manufacturers work with any computer that has a USB port.
- It uses serial transmission and can also supply power to the device over the same cable.
- It is plug and play: the computer recognises the device and installs the driver automatically.
- It is hot-swappable: devices can be plugged in and removed while the computer is running.
- Drawbacks: the cable length is limited, and the transfer speed depends on the USB version supported by the device and the port.
Detecting errors after transmission: parity, checksum and echo check
Errors happen during data transmission because of interference on the connection. There are three effects: data loss, where a bit or a whole packet never arrives; data gain, where extra bits appear that were never sent; and data change, where a bit flips from 0 to 1 or from 1 to 0. The receiving device needs a way of checking that the data it has received is the data that was sent.
A parity check adds one extra bit, called the parity bit, to each byte. With even parity the parity bit is set so that the total number of 1s in the byte is even; with odd parity it is set so that the total number of 1s is odd. The receiving device counts the 1s in each byte it receives, and if the count does not match the parity being used, an error has occurred and the data is re-sent. Parity can only detect an odd number of errors: if two bits in the same byte change, the count of 1s is still correct and the error goes undetected.
For a block of data, a parity byte (also called a parity block check) is used. A parity bit is worked out for each byte and a further parity byte is added for the whole block, so the check covers every row and every column and can identify which byte contains the error.
A checksum is a value calculated from the data itself, for example by adding up the bytes and using the total. The checksum is transmitted with the data. When the data arrives, the receiving device recalculates the checksum from the data it has received and compares it with the checksum that was sent. If the two values are different, the data has been changed during transmission and an error has occurred.
An echo check works by sending the data back. The receiving device transmits the data it has received back to the sender, and the sender compares what came back with what it originally sent. If the two do not match, an error occurred. The drawback is that the data is transmitted twice, which slows the system down, and an error could also occur on the return journey, so the sender cannot be certain which transmission was wrong.
| Method | How it detects an error | Drawback |
|---|---|---|
| Parity check (odd or even) | A parity bit is added to each byte so that the number of 1s is always odd, or always even. The receiver counts the 1s, and if the count is wrong an error has occurred | Only detects an odd number of errors, so two bits changing in one byte is not detected |
| Parity byte / parity block check | A parity bit is worked out for each byte and a parity byte is added for the whole block, so every row and column of the block is checked | Still cannot detect an even number of errors in a row or a column |
| Checksum | A value is calculated from the data and sent with it. The receiver recalculates it and compares the two values; if they differ, the data has changed | A change that leaves the checksum the same would not be detected |
| Echo check | The receiver sends the data back to the sender, which compares it with what was originally sent | The data is transmitted twice so it is slow, and an error could occur on the return journey |
Check digits, ARQ and encryption
A check digit detects errors in data entry, not errors in transmission. An extra digit is calculated from the other digits of the number using a set rule, and it is added to the end of the number. When the number is entered, the computer recalculates the check digit from the digits that were typed and compares it with the check digit that was entered. If the two do not match, one of the digits has been typed or scanned incorrectly, and the entry is rejected. Check digits are used wherever numbers are copied by hand or read by a machine: international standard book numbers (ISBN) end in a check digit, and the bar codes on products include one so that a misread or mistyped code is picked up at the till.
ARQ (automatic repeat query) is a way of making sure that data is received without error. When the receiving device gets data that passes its error check, it sends back a positive acknowledgement to say the data arrived correctly. If the data fails the check, it sends a negative acknowledgement, and the sender automatically re-transmits the data.
ARQ also covers the case where nothing comes back at all, for example because the data was lost. The sender starts a timer when it transmits; if no acknowledgement has arrived when the time runs out, a timeout occurs and the sender re-transmits the data automatically. Together, the acknowledgements and the timeout mean that data is only accepted once the sender knows it arrived correctly.
Encryption turns data into a form that cannot be understood by anyone who does not have the key needed to decrypt it. It is needed whenever data is transmitted, because the data passes through connections and devices that the sender does not control, and anyone who intercepts it could otherwise read it. Encrypting the data means that even if it is intercepted, it is meaningless without the key. It is used for personal details, passwords, messages and card payments.
Symmetric encryption uses the same key to encrypt and to decrypt the data. It is fast and simple, but both the sender and the receiver must have the key, so the key itself has to be sent to the receiver securely, and anyone who obtains the key can read every message encrypted with it. Asymmetric encryption uses a pair of keys that are mathematically linked: a public key and a private key. The public key is available to anyone, and the private key is kept secret by its owner. Data encrypted with the recipient's public key can only be decrypted with that recipient's matching private key, so no secret key has to be shared in advance. Asymmetric encryption is slower than symmetric encryption, so the two are often used together: asymmetric encryption to send a symmetric key safely, and then symmetric encryption for the data itself.
| Symmetric encryption | Asymmetric encryption | |
|---|---|---|
| Keys used | One key, used to both encrypt and decrypt | A pair of keys: a public key and a private key |
| Who has the key | Both the sender and the receiver must have the same key | The public key is available to anyone; the private key is kept secret by its owner |
| Main advantage | Fast and simple | No secret key has to be shared, so the key cannot be intercepted in transit |
| Main drawback | The key has to be sent to the other person securely, and anyone who has it can read the data | Slower than symmetric encryption because of the extra processing |
Key terms you must be able to define
- Packet
- A small chunk of data that is transmitted across a network on its own. A packet contains a packet header, a payload and a trailer.
- Packet header
- The part of a packet that contains the destination address, the packet number and the originator's address, so that the packet can be routed and then put back into the correct order.
- Payload
- The part of a packet that contains the actual data being transmitted, such as part of a file.
- Trailer
- The part of a packet that contains a method of checking for errors, such as a checksum, so that the receiving device can check the packet arrived correctly.
- Packet switching
- The process of transmitting data as packets in which each packet can take a different route to the destination, controlled by routers, and the packets are reordered once the last one has arrived.
- Serial transmission
- A method of transmission in which the bits are sent one at a time along a single wire or channel. It is reliable over long distances because the bits cannot become skewed.
- Parallel transmission
- A method of transmission in which several bits are sent at the same time, one down each of several wires. It is faster for the same clock speed but the bits can become skewed over distance.
- Simplex
- A transmission mode in which data travels in one direction only, for example from a keyboard to a computer.
- Half-duplex
- A transmission mode in which data can travel in both directions, but not at the same time, for example a walkie-talkie.
- Full-duplex
- A transmission mode in which data can travel in both directions at the same time, for example a telephone call.
- USB (universal serial bus)
- A standard interface used to connect devices to a computer and transmit data between them using serial transmission. It is plug and play, hot-swappable, and can supply power to the device.
- Parity check
- An error detection method in which a parity bit is added to each byte so that the number of 1s is always odd (odd parity) or always even (even parity). The receiver counts the 1s, and a mismatch means an error has occurred.
- Parity byte
- An extra byte added to a block of data to check the whole block, because a parity bit is worked out for each byte and a further parity bit is added for each column of the block. Also called a parity block check.
- Checksum
- A value calculated from the data and transmitted with it. The receiving device recalculates the checksum and compares it with the value received; if the two differ, the data has been changed in transmission.
- Echo check
- An error detection method in which the receiving device sends the data back to the sender, which compares it with the data it originally sent. It is slow because the data is sent twice.
- Check digit
- An extra digit calculated from the other digits of a number and added to the end of it, used to detect errors when data is entered by a person or scanned, for example in ISBNs and bar codes.
- Automatic repeat query (ARQ)
- A method of making sure data is received without error: the receiver sends a positive or negative acknowledgement, and the sender re-transmits the data if it receives a negative acknowledgement or if no acknowledgement arrives before a timeout.
- Timeout
- The point at which the sender stops waiting for an acknowledgement and automatically re-transmits the data, because no acknowledgement has arrived within the set time.
- Encryption
- Turning data into a form that cannot be understood by anyone who does not have the key needed to decrypt it, so that intercepted data is meaningless.
- Symmetric encryption
- Encryption that uses the same key to encrypt and decrypt the data. It is fast, but the key must be shared securely between the sender and the receiver.
- Asymmetric encryption
- Encryption that uses a pair of keys: a public key, which is available to anyone and is used to encrypt data, and a private key, which is kept secret and is the only key that can decrypt it.
Applied to real systems
Cambridge sets 0478 in systems you already use - a phone, a school network, a supermarket till, a website, a bank. Use these as models for how to apply the theory to a context you have not seen before, then write your own.
When you send a photo, the app breaks the file into packets. Each packet carries the destination address, a packet number and your address in its header. The packets may travel by completely different routes through the network and may arrive out of order, so the app on the receiving phone uses the packet numbers to put them back into the correct sequence before displaying the picture.
A video call needs full-duplex transmission, because both people are sending and receiving sound and video at the same time. The call is carried by serial transmission over the network, and if the connection drops, the lost packets are detected and re-sent, which is why a weak connection shows as a frozen or distorted picture rather than as silence.
A USB flash drive shows why the standard matters. The same drive plugs into a desktop computer, a laptop and a smart television without an adapter, the computer recognises it and installs the driver automatically (plug and play), and it can be removed without switching the computer off (hot-swappable). USB also supplies the power, which is why some devices need nothing but the cable.
When you log in to online banking, the data you type is encrypted before it leaves your device. The bank publishes a public key that anyone can use to encrypt data sent to it, but only the bank holds the matching private key that can decrypt it. Even if someone intercepted the data on the way, it would be meaningless without that private key.
The bar code on a product ends in a check digit, which is calculated from the other digits. When the code is scanned, the till recalculates the check digit and compares it with the one on the bar code, so a smudged or misread code is rejected instead of being charged as the wrong product. The same idea protects the ISBN on the back of a book.
Flashcards
Click a card to flip it. Mark honestly — the tracker uses this.
Exam-style questions
8 questions, 24 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Exam technique for this topic
- For a packet question, name the header, the payload and the trailer, then give the three items in the header. Write them as a list: destination address, packet number, originator's address.
- In a scenario question about a method of transmission, name the method, give one advantage and one disadvantage that matters for that scenario, and then state your choice. A named method with no reason scores nothing.
- In an error detection question, describe what the receiver does with the check: it counts the 1s, it recalculates and compares, or it compares the echoed data. Descriptions that stop at 'a bit is added' do not score.
- Keep the two contexts apart. Parity, checksum and echo check detect errors after transmission; a check digit detects errors in data entry, such as typing or scanning a number. Using the wrong one loses the mark even when the method is described correctly.
- For encryption, name the key or keys and say who holds each one. Data encrypted with a public key can only be decrypted with the matching private key, and the private key never leaves its owner.