← Back to course
Intro to CS 9-10 / Week 11 / Thursday
4/6
Week 11 · Systems and the Internet

Thursday

Layers and many hands
// Packets, paths and a network that keeps working
⏱ about 20 min

Thursday: Layers and Many Hands

Comet opens the Beacon sensor box to fix a loose wire. Inside are chips, a battery and a tangle of tiny parts.

"How does my little alert rule from week 3 turn into all this?" she asks.

Wren points at the screen, then at the chips. "What do you notice? Our app never talks to the chips directly."

Nova hovers above the open box. "There are layers in between," she says. "Each one hides detail from the layer above."

Meanwhile, the nightly photo job is taking ages. Comet groans. "Three photos, one after another, every single night."

"What if three devices each squeezed one photo at the same time?" Wren asks.

Layers of a computing system

At the bottom, a computer is physical hardware and electrical signals.

Layers of software are built on top of the hardware. Each layer works with the layers above and below it, which reduces complexity.

System software manages a device's resources so that other software can work with the hardware.

Beacon's app sits on top. It asks for a water reading without knowing how the chips measure it.

STACK THE LAYERS, BOTTOM TO TOP
  • Tap a card.
  • Then tap its spot.
1Bottom
2Middle
3Top

Hidden in everyday things

Everyday devices hide their implementation details. You use them without seeing how they work inside.

Take a car stereo. Its data include saved radio station presets and the volume level.

Its procedures include turning the volume up, saving or recalling a station, and mute.

You press mute and the sound stops. How it happens stays hidden. That hiding is abstraction.

DATA OR PROCEDURE?
  • Read the question.
  • Tap your answer.
In a car stereo, the current volume level is...
In a car stereo, mute is...
In the Beacon sensor box, the latest water reading is...
Why can Comet's alert rule ignore how the chips measure water?

Sequential and parallel

Sequential computing does operations in order, one at a time. A sequential solution takes as long as the sum of all its steps.

Parallel computing breaks a program into smaller parts, some of which run at the same time. Distributed computing uses several devices to run a program.

A parallel solution takes as long as its sequential tasks plus the longest of its parallel tasks.

Speedup is the sequential time divided by the parallel time.

Nightly jobSecondsCan run in parallel?
Set up the photo batch10No, it must happen first
Squeeze photo 130Yes
Squeeze photo 220Yes
Squeeze photo 340Yes

These timings are invented for our story. In parallel, three devices each squeeze one photo.

TIME THE NIGHTLY JOB
  • Read the question.
  • Tap your answer.
How long does the job take sequentially?
How long does it take in parallel on three devices?
What is the speedup?
Comet adds ten more devices. Can the job ever beat 10 seconds?
StatementTrue or false?
System software manages a device's resources.?
The Beacon app must know exactly how each chip works.?
A parallel solution is still limited by its sequential part.?
Distributed computing uses several devices to run a program.?
WHY THIS EXERCISELayers and parallel work are two ways real systems handle big, complex jobs.
What is it called when a program is broken into parts that run at the same time? Type two words.
WHY THIS EXERCISEParallel computing is how big jobs, like large data sets, get done faster.
Try it
Pick one device at home, such as a TV remote or an alarm clock.
List two kinds of data it keeps and two procedures it can do. Which details stay hidden from you?
On paper, sketch the nightly job twice as two timelines: one sequential and one parallel. Mark where each ends.

Great systems thinking. Tomorrow is Impact Friday: keeping data safe on shared networks.

← Wednesday