seegongsik
Saved words
Operating systems

What happens when a program runs?

Double-click an app icon and the program "runs." But what exactly is running? It's the moment a file that sat still becomes something alive and moving.

01

A program and running it are different

First, tell two things apart.
One is the program.
A file sitting still
in storage.
The other is it in a running state.
Alive and moving right now,
doing work.
A recipe on paper
versus cooking in progress,
that's the difference.

Program (code)

A file sitting still in storage. Like a sheet of paper with a recipe on it.

Not moving yet

Process (running)

That program actually running. Cooking while reading the paper.

Alive and working now

Two that seem alike but aren't.

A program that's running,
this is called a process.
Just as the same recipe
has to be started cooking
before steam and smell rise,
a program too has to run
before it starts real work.

02

Run it and a process is born

The moment you double-click an app,
the operating system goes to work.
It loads the code from storage
into memory,
and wakes it up:
"alright, start now."
This awakened state
is a process.
Try running it yourself.

Notepad.app
Asleep in storage
Run
Notepad
Not awake yet

Press the run button.

The file stays as it is.
A copy goes up into memory
and becomes a process.
So even if you turn the same app
off and on,
the original file doesn't change.

03

A process has its own place

When a process is born,
the operating system gives it a place.
"You use these memory cells."
The addressed memory
we learned in the earlier area.
Each process
gets its own workspace,
separately.

Notepad process
Its own memory space
Music process
Its own memory space
Each has its own space, so if one program freezes another is fine.

Each process has its own memory space.

Because the places are separate,
they don't interfere with each other.
Even if one app suddenly freezes,
another app is fine.
So that yours and mine
don't get mixed up,
the operating system divided them.

04

You can open many copies of the same app

Here's an interesting point.
There's one program,
but there can be many processes.
Open three browser windows
and from the same program,
three processes have been made.
Open more windows.

Window 1
#201
1 process now

Each window you open is one more process.

Just as one recipe sheet
cooks in several pots at once,
one program
can run many processes.
Each working separately
in its own space.

05

The operating system manages them all in a list

The operating system
holds every running process
in a list.
What its name is,
how much it works,
how much memory it uses.
When a computer slows down,
what you see in the "task manager"
is exactly this list.

#101Browser
Running
#102Music
Running
#103Messages
Running
#104Notepad
Running

The OS gives them all a number (PID) and manages each separately.

Each single process
is alive in its own space,
and the operating system keeps track
of them all in a list.
But there's only one set of parts,
so how do this many processes
run at once?
Next time we unravel that secret.

In one lineA program is a file sitting still, a process is it running and alive. Each process has its own memory space, so if one freezes the others are fine.
Was this helpful? Support seegongsik
Operating systems