What is multithreading? A simple explanation
Processor boxes list cores and threads, and programming courses warn about them early. What is multithreading? It is one program doing several things at once by splitting its work into threads: separate streams of instructions that run side by side while sharing the program's memory. It is why an app can keep responding to your clicks while it saves a big file in the background.
This guide explains threads in plain words, using the glossary of the US National Institute of Standards and Technology (NIST), Microsoft's documentation on processes and threads, and Oracle's Java tutorial. It ends with the free browser game Tank City Reboot, where Multithreading is an upgrade for your tank.
Processes and threads
Start with the bigger unit. When you open a program, the operating system creates a process for it. Oracle's Java tutorial on processes and threads describes a process as a self-contained place to run, and Microsoft's guide About Processes and Threads lists what it holds: its own memory space, its code, the files and other resources it has open, and at least one thread.
A thread is the part that actually runs. NIST's glossary defines a thread as a group of instructions running apart from other such groups, but sharing the memory and resources of the process it belongs to. Every process starts with one, which Microsoft calls the primary thread and Oracle calls the main thread. That thread can create more.
What is multithreading, then?
Multithreading is a process using more than one thread. Each thread has its own place in the code and its own saved state, but all of them share the same memory and open files. Microsoft puts it plainly: all threads of a process share its memory space and system resources.
Why not just start several processes? Oracle notes that threads are sometimes called lightweight processes, because creating a new thread takes fewer resources than creating a new process. And because threads share memory, they can pass work between each other easily. That sharing is the big advantage of threads, and, as we will see, their big risk.

One core or many: how threads actually run
A processor core runs one thread at a time. So how do several threads run at once? There are two answers, depending on the hardware.
- On one core, by taking turns. Oracle explains that a single core's time is shared among processes and threads by time slicing. Microsoft's page on multitasking gives the detail: each thread gets a short slice, about 20 milliseconds, then the system pauses it, saves its state and lets the next one run. The slices are so short that the threads appear to run at the same time.
- On several cores, truly at once. Microsoft notes that on a computer with several processors, the system can run as many threads at the same moment as there are processors.
The program does not have to know which case it is in. It creates the threads, and the operating system spreads them over whatever cores the computer has.
A worked example: a photo app that stays responsive
Microsoft's page on the advantages of multitasking describes a common design: one user interface thread that handles keyboard and mouse input, and worker threads that do other jobs while the interface waits for you. Here it is in a photo editing app.
- You click Export. Saving a large, high-resolution image takes several seconds.
- With one thread. The only thread is busy saving, so it cannot also respond to clicks. The window freezes until the export is done.
- With two threads. The app hands the export to a worker thread. The interface thread is free, so the window keeps responding: you can scroll, zoom, or start editing the next photo.
- A third thread. Another worker makes small preview pictures for the gallery at the same time.
- Who goes first. Microsoft notes that giving the interface thread a higher priority makes the app more responsive, while the worker threads use the processor in the moments when you are not doing anything.
On a single-core computer, the three threads take turns in short slices. On a computer with several cores, the export and the previews can run truly in parallel and finish sooner. Either way, the window never freezes.
The catch: sharing has a cost
Oracle sums up shared memory in one phrase: it makes for efficient, but potentially problematic, communication. If two threads change the same piece of data at the same moment, the result can depend on which one happens to go first, and programs need to be written carefully so threads do not get in each other's way.
There is a second limit. Microsoft warns that system performance can decrease if there are too many threads. Each one takes memory, and switching between them takes time. More threads help only while there is real work for them to do in parallel.
Learn the idea by playing: Tank City Zero Day
Tank City Reboot is a site of two original tank games set inside a computer, with every enemy, power-up and wall named for a real computing idea. In the second game, Tank City Zero Day, each wave ends with a choice of three upgrades, and one of them is Multithreading: more shots per volley, fired in a spread.

Its card gives the idea in one line: "Several threads let one program do several things at once." Several shots leaving your tank together is a fair picture of it. The other upgrades on the page cover cache, pipelining, encryption and more.
A game gives the word and one true sentence. It is not a programming course. For more ideas from the site, read our guides to the retro tank game and zero-day flaws.
Frequently asked questions
What is multithreading in simple words?
One program running several threads, separate streams of instructions that share the program's memory, so it can do several things at once.
What is the difference between a process and a thread?
A process is a running program with its own memory and resources. A thread is a stream of instructions inside it. One process can have many threads, and they all share its memory.
Can a single-core processor run multiple threads?
Yes, by taking turns. Each thread runs for a short time slice, about 20 milliseconds on Windows, so they appear to run at the same time.
Are more threads always faster?
No. Threads cost memory and switching time, and Microsoft warns that performance can drop if there are too many. They help when there is work that can truly happen side by side.
Get started
Play Tank City Reboot: it is free, plays in your browser on a computer or a phone, and needs no account. Then try Zero Day and take Multithreading when Patch Tuesday offers it.
Comments
No comments yet.
Sign in or make an account to comment.