seegongsik
Operating systems

What is time sharing in an OS

You listen to music, write a document, and download a file. It all seems to happen at once, but there's actually only one worker (CPU). Because it switches between them in tiny slices very quickly, it looks to us as if everything is happening at the same time.

01

Everyone wants to use it

Play music, write a document, download a file: all three need the worker (CPU).
But there's only one worker, so the three can't use it all at once.
What can be done?

Play musicneeds the worker
Write a docneeds the worker
Download a fileneeds the worker
→→→
workerCPU
All three want the single CPU. But they can't all use it at once.

Three jobs, but only one worker.

In lesson 2 we saw that a running program is a process.
Right now there are three processes and one worker. How the three share that one worker is what this lesson is about.

02

Taking short turns

Here's how it works. The worker handles the music for a moment, the document for a moment, the file for a moment.
It does a tiny bit, moves on to the next job, and goes around and around.
Press the button and watch.

Now doing·
Music0%
Doc0%
File0%
The worker takes each in quick turns. The three bars fill a little together.

The worker takes short turns → all three make a little progress.

It only does one thing at a time. But because it switches so quickly, all three seem to move forward without stopping.
In fact, the worker is going back and forth between jobs without a break.

03

An illusion made by speed

The secret is speed. If the switching is slow, you can see the turns and think, "Ah, it's doing one at a time."
But if the switching is very fast, the human eye can't see the breaks, so it feels simultaneous.

Now doingMusic
Music
Doc
File
Slow · you can see the turns
When slow, you clearly see the worker take one at a time.

Change the switching speed and see how the picture changes.

A real computer switches its worker thousands of times a second. People simply can't sense that speed.
So we believe it's "at the same time," but it's actually incredibly fast turn-taking.

04

Your device does this too

The device you're reading this on is no different. It draws the screen, plays sound, and checks connections.
It looks as if dozens of jobs are running together, but one worker is switching between them quickly.

Music
playing
Browser
this page
Messenger
waiting
↓ all taking turns on one worker ↓
CPU · switching without rest
That one CPU from computer structure gets sliced this finely and shared.

On your device right now, one worker takes turns.

The smoothness we feel as "many things at once" is the result of an invisible caretaker slicing the worker finely and sharing it out.
The operating system does this behind the scenes.

05

Fast turns: that one idea

The key idea of this lesson is just one: even with a single worker, fast turn-taking looks like doing many things at once. This is time-sharing.
But to take turns, wouldn't you have to stop what you were doing and pick it up again later?

Taking turns = pretending to be many
One worker · switching fast a little at a time · so it looks simultaneous.
Stop and resume
how it changes places
Who first
how order is decided
Beyond
deeper housekeeping
Next time we'll touch how a job is stopped and picked back up, the place-swap.

Once you know about taking turns, here's the next question.

Because the operating system slices the worker finely, we can enjoy many tasks on a single computer.
This simple trick of "one pretending to be many" makes computers far more useful.

In one lineThere's only one worker (CPU), but switching between jobs in tiny slices very quickly makes it look like doing many things at once. This is time-sharing. The smoothness of "at the same time" that we feel is the result of the operating system slicing its single worker finely and sharing it out.
← Operating systems
Was this helpful? Support seegongsik