Topic 06

Processes and Multitasking

Concept

Open the task manager on your computer — Activity Monitor on a Mac, Task Manager on Windows — and you'll see a long list of things running. Dozens of them. Most you never started and have never heard of, yet they're all alive right now.

Each entry in that list is a process — one program the operating system is currently running. In the previous chapter you saw what "running a program" means: its instructions get loaded from storage into memory, and the CPU works through them. A process is exactly that program, mid-run. The operating system's job is to keep all of these going at once, which is the subject of this topic.

One processor, many processes — switched in turn
One CPUone at a time
Process Aa brief turn
Process Bthen a turn
Process Cand so on

What Is a Process?

A process is a single running program. The same app can even be running as more than one process at a time — open three browser windows and the system may track them as separate processes — but the idea holds: a process is a program in the middle of doing its work, occupying memory and taking turns on the CPU.

This is the difference between a program at rest and a program in motion. The app sitting on your storage, not yet opened, is just files — a recipe in a cookbook. The moment you launch it, the operating system creates a process for it, and that process is the recipe actually being cooked. Close the app and the process ends; the files on storage stay exactly where they were.

How Can So Many Run at Once?

Here is the part that surprises people. A simple processor core can really only do one thing at any single instant — it follows one instruction, then the next. So how can your computer play music, download a file, and show this page seemingly all at the same time?

The trick is speed. The operating system gives the CPU to one process for a tiny slice of time — a few thousandths of a second — then pauses it, hands the CPU to the next process for its slice, and keeps cycling through them. It switches so fast that, to you, every process looks like it never stopped. This rapid taking-of-turns is what multitasking actually is.

A chef in a small kitchen works the same way. Only one pan gets full attention at a time, but the chef stirs one, turns to chop for the next, checks the oven, and circles back — switching constantly. No single dish is ever truly cooked "at the same time" as another, yet by moving fast enough, the whole meal comes together. The CPU is the chef; each process is a dish; the operating system decides whose turn is next.

One honest note: this is the simple picture. Real computers also have several CPU cores, so a handful of processes genuinely do run at the very same instant, and the operating system blends true parallel work with the fast-switching just described. The take-turns idea is the foundation; the multiple-cores detail sits on top of it.

Background and Foreground

Most of the processes in that task-manager list are running in the background — doing their work without any window on screen. Your system checks for updates, syncs files to the cloud, watches for incoming messages, and keeps the clock right, all through background processes you never see.

A foreground process is the one you're actively looking at and using — the app whose window is in front of you. The split is just about attention, not importance. A background process is every bit as real and running as the foreground one; it simply has no window asking for your focus.

When a Process Misbehaves

Sometimes a process gets stuck — caught in a loop, or waiting forever for something that never comes. You've seen the result: a window greys out and the system labels it "not responding." The process is still there, still a process, but it has stopped taking its turns usefully.

Because the operating system is the one handing out turns on the CPU, it also holds the power to stop any process entirely. When you "force quit" a frozen app, you're asking the operating system to end that process by hand. The app vanishes from memory; your saved files on storage are untouched, and you can simply launch it again, which starts a fresh process.

Common Confusions
  • "Only the app on screen is running." The one in front of you is just the foreground process. Dozens more run in the background at the same time, with no window to show for it.
  • "The CPU does everything truly at the same time." A core does one thing per instant. It takes rapid turns between processes; the speed is what makes it look simultaneous.
  • "Background processes are viruses." Almost all are normal: updates, syncing, notifications, the clock. Running unseen is just how most of an operating system works.
  • "Force-quitting an app deletes it." It only ends the running process and frees its memory. The app's files stay on storage, ready to launch again.
Why It Matters
  • "Process" is one of the most-used words in all of computing — once it's clear here, the Linux, cloud, and container courses have a word to build on.
  • A container, which you'll meet in the Docker course, is essentially one isolated process — the same idea you just learned, fenced off from the rest of the system.
  • A server's whole job is running processes that wait for and answer requests, so this is the shape of what a server actually does all day.
  • Knowing the operating system can stop any process is why "force quit" works, and why a frozen app rarely means you have to restart the whole machine.

Knowledge Check

What is a process?

  • A single program that the operating system is currently running
  • An app's files sitting unopened on storage, waiting to be launched
  • A labeled place on the disk where the system organizes related files
  • The operating system itself, which is the only thing that ever runs

A single CPU core seems to run many programs at once. How does it actually do that?

  • It takes rapid turns, giving each process a tiny slice of time
  • It genuinely runs every process at the exact same instant, all in parallel
  • Storage runs the extra programs while the CPU handles just one of them
  • It merges all the programs into one combined program and runs that

Most of the entries in your task manager are running in the background. What does that mean?

  • They are real, running processes that just have no window on screen
  • They are almost certainly viruses, since they run without your permission
  • They are paused programs that use nothing until you click to open them
  • They are extra copies of the one app whose window you are looking at

An app freezes and shows "not responding," so you force quit it. What happens to your saved files?

  • Nothing — force quit ends the process, but saved files stay on storage
  • All of the app's files are deleted from storage along with the process
  • The whole computer restarts and clears every file you had open
  • Everything you ever saved in that app is permanently erased

You got correct