Cambridge IGCSE Computer Science (0478/0984) · Topic 2 Data transmission
Mini-Lesson
Data transmission
4 missions. Guess, learn, then check. Your place is saved.
Mission 1How does a video arrive in order if its pieces take different routes?
Mission 2Parallel sends 8 bits at once. So why is USB serial?
Mission 3One bit flips on the way. How can the receiver even tell?
Mission 4How can you lock a message for someone you have never met?
The specification points and sources are listed under the lesson: see Sources.
Mission 1
How does a video arrive in order if its pieces take different routes?
Make a guess: How does a video arrive in order if its pieces take different routes?
Networks · packets and packet switching
Splitting data into packets
Before data is sent across a network, it is broken into small pieces called packets.
Each packet is sent on its own and the receiving computer joins them back together.
Small packets share the network's links fairly: no single huge file blocks a link. If one packet is lost or damaged, only that packet needs to be sent again.
Networks · packets and packet switching
Inside a packet
The header holds the destination address, the source address (the originator's address) and the packet number, used to put the data back in order.
The payload is the actual data being carried.
The trailer marks the end of the packet and can hold data used to check for errors.
Quick check
?A web page is sent as 40 packets. Which part of each packet lets the receiving computer put the page back together in the right order?
Networks · packets and packet switching
Packet switching
In packet switching, each packet is sent across the network separately.
Routers read each packet's destination address and send it on towards its destination, one hop at a time.
Each packet may take a different route, depending on which links are free or working.
So packets can arrive out of order. Once the last packet arrives, the receiver uses the packet numbers to reorder them.
Your answer
?Four packets arrive in this order. Packet 3: "E GA" · Packet 1: "MEET" · Packet 4: "TE" · Packet 2: " AT TH". Type the original message.
Quick check
?A cable between two routers is cut while a file is being sent. What happens to the packets still to be sent?
Mission check
?How does a video arrive in order if its pieces take different routes?
The video is split into packets, and each header includes a packet number. Routers send each packet on whatever route works best, so they can arrive jumbled. When the last packet arrives, the receiving computer uses the numbers to put them back in order.
Mission 2
Parallel sends 8 bits at once. So why is USB serial?
Make a guess: Parallel sends 8 bits at once. So why is USB serial?
Data transmission · methods and USB
One wire or many?
Serial transmission sends data one bit at a time down a single wire.
Parallel transmission sends several bits at the same time down several wires, e.g. 8 bits on 8 wires.
Over the same short distance, parallel can move more data per second.
Parallel is used over short distances, e.g. inside a computer or within an integrated circuit.
Data transmission · methods and USB
Why distance changes things
Over a long parallel cable, bits sent together arrive at slightly different times. This is skew, and the data can be corrupted.
Wires lying side by side can also cause interference with each other.
Serial has no skew, so it is more reliable over long distances.
Serial cables need fewer wires, so they are cheaper. Serial is slower than parallel over a short distance.
Quick check
?A school wants to link a computer to a printer 20 m away down a corridor. Which method is most suitable?
Data transmission · methods and USB
Which way can data go?
Simplex: data travels in one direction only, e.g. a computer sending data to a monitor.
Half-duplex: both directions, but only one direction at a time, e.g. a walkie-talkie.
Full-duplex: both directions at the same time, e.g. a phone call.
Each one combines with serial or parallel, e.g. "serial half-duplex".
Quick check
?A weather sensor sends readings to a computer. The computer never sends anything back. Which method is this?
Data transmission · methods and USB
The universal serial bus
USB is an industry-standard interface that sends data by serial transmission.
Benefits: devices are detected automatically and the right driver is loaded; one standard fits many devices; it can power or charge a device; newer versions are backward compatible.
Drawbacks: maximum cable length is limited (5 m for USB 2.0); older versions may stop being supported.
Quick check
?Which of these is a drawback of USB?
Mission check
?Parallel sends 8 bits at once. So why is USB serial?
On a long parallel cable, bits sent together arrive at slightly different times (skew) and wires interfere with each other. Serial sends one bit after another down one wire, so it stays reliable over distance and needs a cheaper cable. That is why USB, used with cables, is serial.
Mission 3
One bit flips on the way. How can the receiver even tell?
Make a guess: One bit flips on the way. How can the receiver even tell?
Data transmission · error detection
When bits go wrong
Interference during transmission can cause data loss, data gain or data change.
The receiver never sees the original, so the sender adds extra check data.
Parity check: one bit of each byte is a parity bit. Even parity: each byte holds an even number of 1s. Odd parity: an odd number.
The receiver counts the 1s. A wrong count means an error, so the data is resent.
Your answer
?A system uses even parity. The parity bit is the leftmost bit. The 7 data bits are 1101011. Write the whole byte that is sent.
Data transmission · error detection
Finding the faulty bit
One parity bit misses errors where two bits change: the count stays even (or odd).
A parity block check sends several bytes, each with a parity bit, plus a parity byte: the parity bit for each column.
The receiver checks every row and column. The faulty bit is where the failing row meets the failing column, so it can be corrected.
Quick check
?This block was sent with even parity on every row and column (column 1 is the parity bit, the last row is the parity byte). Which bit is wrong?
Data transmission · error detection
Checksum and echo check
Checksum: the sender calculates a value from a block of data with an agreed algorithm and sends it too.
The receiver recalculates it from the data received. Different values mean an error, so the data is resent.
Echo check: the receiver sends the data back; the sender compares it with the original and resends if different.
Drawback: an echo error may have happened on the way back.
Data transmission · error detection
Automatic repeat query
ARQ (automatic repeat query) uses acknowledgements and a timeout.
The receiver checks the data, e.g. with a checksum. No error: it sends a positive acknowledgement. Error: it sends a negative acknowledgement and the sender resends.
Timeout: if no acknowledgement arrives within a set time, the sender resends automatically.
This repeats until the data arrives correctly, or a set number of attempts is reached.
Data transmission · error detection
Check digits
A check digit is a final digit calculated from the other digits. It catches data entry errors.
Used in ISBNs (book numbers) and barcodes.
On entry the check digit is recalculated and compared. A mismatch shows a mistake, e.g. a wrong or swapped digit.
In an exam, the question tells you which check-digit method to use (ISBN-13 is one example).
ISBN-13: multiply the 12 digits alternately by 1 and 3, add, take the remainder ÷ 10, and subtract it from 10 (10 gives 0).
Calculate
?Find the ISBN-13 check digit for 978-1-84356-028-?
Mission check
?One bit flips on the way. How can the receiver even tell?
The sender adds check data worked out from the bits, such as a parity bit or a checksum. The receiver works it out again from what arrived; if it doesn't match, there is an error, and ARQ gets the data sent again.
Mission 4
How can you lock a message for someone you have never met?
Make a guess: How can you lock a message for someone you have never met?
Security · encryption
Why encrypt?
Data sent over a network can be intercepted by anyone tapping into the connection.
Encryption uses an algorithm and a key to turn plaintext into ciphertext.
Encryption does not stop interception. It makes intercepted data meaningless to anyone without the right key.
Decryption uses a key to turn the ciphertext back into plaintext.
Quick check
?An attacker intercepts an encrypted file on its way across the internet. What has encryption achieved?
Security · encryption
Symmetric encryption
Symmetric encryption uses the same key to encrypt and to decrypt.
So the sender must get a copy of the key to the receiver before any message can be read.
If the key is intercepted while it is being shared, the attacker can decrypt every message sent with it.
Sharing the key safely is the big weakness of symmetric encryption.
Security · encryption
Asymmetric encryption
Asymmetric encryption uses two different keys: a matching public key and private key.
The public key can be given to anyone. It is used to encrypt messages for its owner.
The private key is kept secret by its owner and never sent. Only it can decrypt what the matching public key encrypted.
So no secret key ever has to travel across the network.
Quick check
?Ana wants to send Ben a message that only Ben can read, using asymmetric encryption. Which key should Ana encrypt it with?
Quick check
?An attacker copies Ben's public key as it is sent to Ana. What can the attacker now do?
Mission check
?How can you lock a message for someone you have never met?
Asymmetric encryption: the receiver publishes a public key that anyone can use to encrypt messages to them. Only the receiver's private key, which never leaves them, can decrypt those messages, so nothing secret is sent.
Recap
Big ideas
Data is split into packets; each has a header (destination address, source address, packet number) and a payload.
In packet switching, routers send each packet separately, so packets may take different routes and arrive out of order; the receiver reorders them using the packet numbers.
A packet also has a trailer that marks its end.
Serial: one bit at a time, one wire; reliable over distance, cheaper. Parallel: several bits at once; fast but only over short distances because of skew.
Simplex is one way, half-duplex is both ways in turn, full-duplex is both ways at once.
USB is serial: automatic detection and drivers, power supply, one standard; limited cable length.
Interference causes data loss, gain or change; parity checks, checksums and echo checks detect it after transmission.
A parity block (with a parity byte) can locate the exact faulty bit; ARQ uses acknowledgements and a timeout to get data resent.
A check digit, recalculated on entry, catches data-entry errors in ISBNs and barcodes.
Encryption doesn't stop interception; it makes intercepted data unreadable without the key.
Symmetric: one shared key, which must be passed on safely. Asymmetric: encrypt with the receiver's public key, decrypt with their private key.
🏆
Mini-lesson complete!
⭐⭐⭐
You've worked through Data transmission for Cambridge IGCSE Computer Science (0478/0984). 🎉
Mission 1How does a video arrive in order if its pieces take different routes?
Mission 2Parallel sends 8 bits at once. So why is USB serial?
Mission 3One bit flips on the way. How can the receiver even tell?
Mission 4How can you lock a message for someone you have never met?
6 GS1, "How to calculate a check digit manually", https://gs1.org/how-calculate-check-digit-manually (GTIN-13: weights 1 and 3 from the left, subtract the sum from the nearest equal or higher multiple of ten). Apache Commons Validator, EAN13CheckDigit, https://commons.apache.org/validator/apidocs/org/apache/commons/validator/routines/checkdigit/EAN13CheckDigit.html ("Modulus 10 EAN-13 / UPC / ISBN-13 Check Digit")