AP Computer Science Principles · Unit 4 lecture · Part 11 of 11 · 7 min

Unit 4 wrap-upPut it together

Mr. Thompkins
That's the whole unit. Let's zoom out. It's three topics, but one big story: the internet works because it's split into pieces, packets, networks and processors, and it survives because there's always more than one way through.
TopicBig ideaWhat the exam asks
4.1 The internetA network of networks; data moves in packets along dynamic routesVocabulary, packets, bandwidth time, TCP or UDP, internet vs Web
4.1 ProtocolsOpen, agreed-upon rules let any device join; that helps it scaleWhich protocol does which job; why open matters
4.2 Fault toleranceRedundant paths let data be rerouted when parts failCount paths, minimum failures, single points of failure
4.3 Parallel and distributedSplit work across processors or devices; the sequential part limits speedupParallel time, speedup, best split, when more processors stop helping
Unit 4 on one page.

Three threads run through everything. Splitting: messages become packets, the internet is many networks, and big jobs become tasks on many processors. Shared rules: open protocols let any device join and let packets be put back together. Redundancy: extra paths make the network fault tolerant, and extra machines let a distributed job survive a failure. And each of these has a cost: resending takes time, redundancy takes hardware, and the sequential portion limits every speedup.

?Wait, which protocol puts packets back in order?
TCP. IP routes packets toward their destination, and TCP keeps track of them, has lost ones resent and puts them in order. UDP does neither, which makes it faster.
Pause and think
Connect two topics: why does splitting messages into packets help the internet be fault tolerant?
I thought about it. Show me
Each packet is routed on its own, so when a link fails, the packets still to come are simply sent along another path. The message doesn't have to start over, and TCP can have the few packets that were lost resent.

Traps that cost points

✕ Saying the internet and the World Wide Web are the same.
✓ The Web is linked pages using HTTP. It runs on the internet, along with email, calls and games.
✕ Thinking packets travel together, in order, along one fixed path.
✓ Each packet is routed on its own. Out of order, or missing, is normal.
✕ Giving routing to TCP, or reliability to UDP.
✓ IP routes. TCP guarantees delivery and order. UDP hurries with no checks.
✕ Saying open protocols means encrypted data.
✓ Open means anyone can follow the rules. Encryption is separate (Unit 5).
✕ Forgetting to multiply bytes by 8.
✓ Bandwidth is in bits per second. Convert the file size to bits first.
✕ Treating a failed device like one failed connection.
✓ A device failure removes every connection it has.
✕ Dividing total time by the number of processors.
✓ Assign whole tasks, take the busiest processor, then add the sequential steps.
✕ Writing speedup upside down, or as time saved.
✓ Speedup = sequential ÷ parallel. It's a ratio, usually between 1 and the number of processors.

Key relationships for Unit 4

$\text{time} = \dfrac{\text{bits}}{\text{bandwidth}}$
Transfer timeBytes × 8 = bits
$\text{sequential time} = \text{sum of steps}$
One processorEvery step, one after another
$\text{parallel time} = \text{sequential part} + \text{longest parallel part}$
Several processorsThe busiest processor sets the finish
$\text{speedup} = \dfrac{\text{sequential time}}{\text{parallel time}}$
How many times fasterLimited by the sequential part
$n\ \text{bits} \rightarrow 2^n\ \text{addresses}$
Address space (bonus)Why IPv6 uses 128 bits

Exam strategy for Unit 4

  1. Unit 4 is 11 to 15 percent of the multiple choice. No written-response prompt is about it directly, so nearly all its points are in Section I.
  2. Vocabulary questions: match the word exactly. Protocol, packet, bandwidth, path, routing, redundancy, fault tolerant, speedup.
  3. Network drawings: redraw them, cross out what failed, and test singles before pairs.
  4. Timing questions: write the sequential time, the longest task and the sequential part before doing anything else.
  5. Select two answers: mark each statement true or false on its own first.
  6. Your Create task can be about a Unit 4 idea, like a program that finds missing packet numbers. The written responses are still about your code, so the networking is the story around it.
Mixed practice
A school streams its graduation live and also lets families download a full recording afterward. (a) Which protocol fits the live stream, and which fits the download? (b) The recording is 3 GB, and a family's bandwidth is 40 Mbps. How long does the download take? (c) Editing the recording takes a 10-minute import, then four independent clips of 30, 20, 20 and 10 minutes, then a 5-minute export. Import and export run alone. What is the minimum time on two processors, and the speedup?
  1. (a) Live stream: UDP, because waiting for lost packets would freeze it. Download: TCP, because the file must arrive complete.
  2. (b) 3 GB = 3,000 MB = 24,000 megabits. 24,000 ÷ 40 = 600 seconds, which is 10 minutes.
  3. (c) Sequential: 10 + 30 + 20 + 20 + 10 + 5 = 95 minutes.
  4. The clips total 80 minutes, so the ideal is 40 per processor: 30 + 10 = 40 and 20 + 20 = 40. Parallel time: 10 + 40 + 5 = 55 minutes.
  5. Speedup = 95 ÷ 55 ≈ 1.73.
    Why?
    Brute force in Python confirms 40 is the best possible split of those four clips.

Answer: (a) UDP for the live stream, TCP for the download. (b) 600 seconds, 10 minutes. (c) 55 minutes on two processors, speedup about 1.73.

Stuck? Get a hint
  1. For (a), ask: is waiting worse, or losing a piece?
  2. For (b), GB to MB, then × 8, then ÷ 40.
  3. For (c), split the four clips into two piles of 40.
Check yourself
A network has connections P-Q, Q-R, R-S, S-P and Q-S. What is the minimum number of connections that must fail before P can no longer communicate with R?
  1. A1
  2. B2
  3. C3
  4. D4
Show the answer

B. P has only two connections, P-Q and P-S. Cutting both isolates P, so 2 is enough, and no single failure works: without P-Q, P goes P-S-R; without P-S, P goes P-Q-R. The answer is 2.

Check yourself
Which statement best explains why the internet has been able to grow from a few research computers to billions of devices?
  1. AIts protocols are open, and new networks can join by following them
  2. BIts protocols are proprietary, and one company approves new networks
  3. CEvery packet follows one fixed path, and paths never change
  4. DAll data travels as one large file, and no packets are needed
Show the answer

A. Scalability comes from open protocols that any new network can follow, with no central approval. The other choices describe the opposite of how the internet works: protocols are open, routing is dynamic and data travels in packets.

Mr. Thompkins
That's Unit 4. Now go prove it: take the Unit 4 quiz, and draw every network on scratch paper, even the easy ones. When you miss one, come back here and open that section's recall cards. See you in Unit 5, where we ask what all this connection does to people.