Skip to main content
SWStudyWalks Search

Operating Systems

The narration between entries paraphrases; it never reads an entry aloud before the entry plays. Every entry in this lecture plays exactly as it does on its own page — same file, same speed, nothing laid over it.

What you can do after this

  1. Say why no application ever commands the hardware
  2. Tell a program, a process and a thread apart
  3. Say what a race condition is, and what answers it
  4. Say what addresses a running process actually sees
  5. Name the three parts of the protection triad, and what each decides

What it covers

26 entries in 10 topics. Each number links to that entry on its own.

  1. 1. The mediator

  2. 2. Two memories, two modes

  3. 3. Processes and threads

  4. 4. Sharing the processor

  5. 5. When timing decides

  6. 6. Round-robin, run

  7. 7. The address a process sees

  8. 8. Files

  9. 9. Protection

  10. 10. The capstone

Check yourself

Why does no application ever command the hardware?

Because applications ask the operating system to act on their behalf. A program that appears to drive a device is driving the operating system, and the request crosses a controlled boundary from user mode into kernel mode.

What separates a program, a process and a thread?

A program is passive instructions on disk. A process is an instance of that program in execution, with its full state kept by the system. A thread is a lightweight path of execution inside a process, sharing its memory.

What is a race condition, and what answers it?

An outcome that depends on the sequence or timing of events nobody controls — the fault is in the interleaving rather than any instruction. A semaphore answers it: a counted permission acquired before use and released after.

What addresses does a running process see?

Virtual ones. It never sees physical memory; address translation maps its view onto whatever physical memory the system assigned, with recent translations cached inside the processor.

What are the three parts of the protection triad?

Authentication identifies who is acting, authorisation decides what they may do, and the third records what was done. They are three separate questions, and collapsing them into one idea of security loses all three.

Lecture transcript

The narration as recorded, in order. Where an entry plays, the transcript links to it rather than reprinting it — the entry plays from its own file, unaltered, and says the same thing on its own page.

This is Unit Six of Computer Science: the operating system. Unit Five described a computer system and left something unnamed. Every layer it described — memory, the processor, the disk — was being managed by something, and this unit names it. The central claim is that no application ever touches the hardware. Not once. A program that appears to command a disk or a network card is asking the operating system to do it, and the direct line applications seem to have does not exist. Most of the unit follows from that. If one thing mediates for everything, it has to decide who runs when, keep programs from interfering with each other, give each one an address space that is not the real one, and answer three separate questions about who is allowed to do what. There is also a hazard in here worth taking seriously — a category of failure where nothing is wrong with the code and the outcome still depends on timing. By the end you will be able to do five things. One: say why no application commands the hardware. Two: tell a program, a process and a thread apart. Three: say what a race condition is and what answers it. Four: say what addresses a running process actually sees. Five: name the three parts of the protection triad.

Four entries establishing the unit's central claim, including the error entry that states it most sharply. Programs do not reach the hardware — and once you accept that, most of what an operating system does becomes predictable.

What it is.

CS 0291 The Operating System

The core piece of software managing and controlling how hardware and software connect. Everything in the machine passes through it.

How programs get things done.

CS 0292 The Mediator

Applications do not manipulate hardware — they ask the operating system to act for them, and it decides how and whether to comply.

And the error.

CS 0293 "My App Talks to the Hardware"

A program that appears to command hardware is commanding the operating system. The direct line applications seem to hold is not there — which matters the moment something behaves in a way the program alone cannot explain.

Keeping them apart.

CS 0294 Isolation

Programs running at the same time on the same processor and memory operate independently and never interfere with each other. That separation is enforced rather than agreed to.

Three entries on structure. Storage that survives a shutdown and storage that does not, the boundary a program crosses to ask for anything, and the components the operating system divides into.

Two kinds of storage.

CS 0296 Primary and Secondary Memory

Primary memory is volatile and loses everything at power loss. Secondary memory — drives, solid state and otherwise — keeps it. Unit Five's volatility, now given a place in the system.

Crossing the boundary.

CS 0297 Kernel Mode and the System Call

A request from user mode asking kernel mode to perform an action, crossing an isolation boundary in a controlled way. The boundary exists so that the crossing can be checked.

The parts.

CS 0298 The OS Components

File systems, memory managers, process managers, network stacks and more — cooperating components rather than one monolithic thing. The rest of the unit works through them.

Three entries drawing a distinction people blur constantly. A program is not a process, and a process is not a thread — and the difference between the second two is what makes concurrency possible at all.

What a program becomes.

CS 0301 The Process

An instance of a program in execution. Passive instructions sitting on disk become an active entity the moment they are loaded and started.

What gets remembered.

CS 0302 The Process Control Block

The operating system keeps every detail of a process's execution state whenever the process is not the one running — which is what makes stopping and resuming it possible.

The smaller unit.

CS 0303 The Thread

A lightweight path of execution sharing its process's memory and resources. Lightweight is the point — and sharing memory is where the trouble in this unit comes from.

Three entries on how several programs occupy one processor. Each gets a short frame, something decides the order, and a process moves between three states — one of which is waiting on something that has nothing to do with the processor.

How several run at once.

CS 0304 Multitasking and the Time Slice

Running multiple processes at once by giving each a short frame of processor time in turn. The appearance of simultaneity, produced by rapid alternation.

Who decides.

CS 0305 Scheduling

Removing the running process from the processor and selecting the next one according to a strategy. The strategy is a policy choice, and different strategies favour different things.

Three states.

CS 0306 The Three Process States

Ready while awaiting a core, running while executing, and blocked while awaiting something else — a disk, a network, an input. A blocked process is not slow. It is waiting on the world.

Two entries on the hazard sharing creates, and this is the one to take seriously. Code can be entirely correct and still produce the wrong answer depending on which of two things happened first.

The hazard.

CS 0307 The Race Condition

An outcome depending on the sequence or timing of events nobody controls. The failure is not in any one instruction — it is in the interleaving, which is why it reproduces unreliably and is difficult to find.

The answer.

CS 0308 The Semaphore

A data type controlling access to a resource — a counted permission acquired before use and released after. It converts an uncontrolled interleaving into a controlled one.

One procedure, and it makes scheduling concrete. A rotation, one slice each, run against a clock — including what happens when a process finishes early and hands its remaining time back.

Watch a schedule run.

CS 0309 Round-Robin, Run to the Clock

Each process granted one time slice in rotation, with a finished process releasing the processor early rather than holding it idle. The strategy is simple to state and the trace shows what it actually produces.

Two entries on an illusion so complete that programs are written entirely inside it. A running process never sees physical memory — it deals only in addresses that get translated on the way through.

The illusion.

CS 0313 Virtual Memory

A running process deals only in virtual addresses, with translation mapping its view onto whatever physical memory the system chose. It cannot tell, and does not need to.

Making it affordable.

CS 0314 The Translation Lookaside Buffer

Recent address translations cached inside the processor, with a hit producing the real address immediately. Unit Five's locality doing the work again — translation is worth caching for exactly the reason memory is.

Four entries on the part of the system users actually see. The unit a person thinks in, the system that names and finds it, how those names are organised, and what has to be true for any of it to survive a crash.

The unit.

CS 0316 The File

A collection of related information on a storage device — the smallest unit of storage from a user's point of view, whatever it looks like underneath.

The system.

CS 0317 The File System

Defining file names, storing files on a device and retrieving them — designed under real pressure from capacity, speed and reliability at the same time.

The organisation.

CS 0318 The Directory

A managed set of files holding attributes, location and ownership as name-and-value pairs. The folder metaphor is a presentation of this, not the thing itself.

And survival.

CS 0319 Reliability

Reducing faults and ensuring information survives operating system crashes and hardware failure. The assumption is that both will happen, not that they might.

Three entries, and the first one separates three questions that get collapsed into a single idea of security. Who is this, what are they allowed to do, and can we prove afterwards what they did — three different problems.

Three aspects.

CS 0321 The Protection Triad

Authentication identifies the party behind an action, authorisation decides what that party may do, and the third aspect records what was done. Collapsing them loses the ability to answer any of the three properly.

The first question.

CS 0322 Authentication

Checking whether presented credentials match a record of authorised users — traditionally a password, which is one secret standing in for an identity.

Strengthening it.

CS 0323 Two-Factor Authentication

Pairing the password with a second factor such as a phone-delivered code. Two things of different kinds, so that stealing one is not enough.

One capstone, and it does something none of the others do — it goes back. The song from Unit Five gets played again, and every assumption that picture quietly made now has a name.

The capstone. The song, replayed.

CS 0327 The Referee Revealed

Unit Five's song played inside a picture that assumed a referee without naming one. Processes, scheduling, virtual memory, files and protection were all there the first time — unnamed.

Five things you can now do. You can say why no application commands the hardware — every apparent command is a request to the operating system, crossing a boundary that exists so the crossing can be checked. You can tell a program, a process and a thread apart: instructions at rest, an instance in execution, and a lightweight path sharing that instance's memory. You can say what a race condition is — an outcome depending on timing nobody controls — and that a counted permission converts the interleaving into a controlled one. You can say what addresses a process sees: virtual ones, translated on the way through, with recent translations cached for the same reason memory is cached. And you can name the protection triad — identify, permit, record — and say why collapsing the three loses the ability to answer any of them.

This is free, and stays free. If it helped, here is what keeps it running.