seegongsik
Saved words
Operating systems

Stopping and picking back up

Every switch saves where you were and loads it back.

01

Leave a note before you stop

Picture yourself working at a desk when something else suddenly needs you.
If you just get up and walk away, you will not remember where you left off when you come back. So you jot down a quick note that says "got this far," then you leave.
When you return, you read the note and pick up exactly where you stopped. A CPU does the same thing. When it pauses a task, it saves the whole current state like a note, and loads it back when it returns.

Task A in progressgot this farSaveRestoreBack, continuegot this far

Save your state before leaving, restore it when you come back.

When a task pauses, its state is saved, and when it resumes, that state is restored.

02

Stretch out the moment it switches

Let us slow down that brief moment when the work changes.
First, task A is running. When it is time to switch, the state of A is saved. Then the saved state of task B is loaded. Only then does B start running.
The key part is this. During the middle stretch of saving and loading, neither A nor B gets any work done. That gap is purely time spent changing seats.

No task runs hereTask ASaveA stateRestoreB stateTask B

Between saving and restoring, no task makes progress.

A switch is a save step then a restore step, and nothing gets done in between.

03

Switching too often costs you

A switch always costs a little. It is the time to write the note and read it again.
Use the slider below to set how many times the work switches during the same one second. As the number of switches goes up, the time spent changing seats goes up too, and the real working time goes down.
Switch too rarely and one task hogs the seat for too long. Switch too often and you spend your time switching instead of working. So you need a sensible balance.

Switches per second6
Real work time 82%Time changing seats 18%
A sensible balance. Switch too rarely and one task hogs the seat; switch too often and you spend your time switching instead of working.

Move the slider to see how switching cost eats into working time.

A switch is not free, so switching too often eats into the time left for actual work.

04

Same time, different results

Take the same amount of time and put two styles side by side.
The left one switches only now and then. Few slots go to changing seats, so many slots are real work. The right one switches very often. A switching cost slips into every slot, so few slots end up as actual work.
The same time passed for both, yet the amount finished differs. What made the difference was not the workload but the time thrown away on switching.

Switch now and then
Work 10 ยท Switch 2
Switch very often
Work 6 ยท Switch 6
work slot switch slot

Both rows are the same length, but the frequent-switch one has fewer work slots.

When switches are frequent, the same time finishes less actual work.

05

Put it on one page

Just remember three things.
First, the note is the state. When a task pauses, saving all its progress so far is what leaving a note means.
Second, switching is two actions, a save and a load. Nothing runs in between. Third, that is why switching too often costs you. As switching time piles up, the time left to work shrinks.

One
The note is the state. When you stop, you save all the progress so far.
Two
Switching is two actions, saving and loading again. Nothing runs in between.
Three
So switching too often costs you. As switching time piles up, work time shrinks.

Note is state, switching is save and restore, too often costs you.

In one lineA switch is saving and restoring state, and it is not free, so it should be done in moderation.
Was this helpful? Support seegongsik
โ† Operating systems