Nepedia
Back to Discover
Fluent Reader
💻

Multithreading (computer architecture)

technology Maturity 7-9 Next article →

A computer brain is called a CPU. It can do many things at once using a method called multithreading.

Multithreaded process
Multithreaded process

This is important because it helps the computer finish more work. It is very hard to make a single task go faster. Instead, engineers focus on making the whole system more efficient. Most computer systems use multitasking to handle many threads at once. This keeps the parts of the CPU from sitting idle. When one task stops, another can take its place.

Multithreaded process
Multithreaded process

Multithreading works by switching between different paths of work. One way is called coarse-grained multithreading. In this way, a task runs until it hits a long wait. This wait might happen if the CPU needs data from memory. This can take hundreds of cycles to finish. Instead of waiting, the CPU switches to a ready task. The hardware does this by keeping two sets of registers. Registers are small storage spots that hold the current task's info.

Multithreaded process
Multithreaded process

There is also a faster way called fine-grained multithreading. This method switches tasks very often. It can even switch every single CPU cycle. This was once called barrel processing. In that name, the parts of the processor act like staves in a barrel. This type of switching helps remove pauses in the work pipeline. However, it requires more hardware to track each task's ID. It also needs larger caches to prevent tasks from interfering with each other.

Multithreaded process
Multithreaded process

The most advanced version is simultaneous multithreading, or SMT. A normal processor usually handles one task at a time. An SMT processor can issue instructions from many threads in one cycle. This uses up all the empty slots in the processor. Many famous companies use this technology today. Intel calls its version Hyper-Threading Technology. IBM uses it in their POWER and z13 series chips. AMD also uses it in their Zen microarchitectures.

Multithreaded process
Multithreaded process

Using multithreading has both good and bad sides. It can make a program run much faster. For example, some tests show a 100% speed improvement. But, multiple threads can also fight over the same hardware. This struggle is called contention. It can actually make a single task run slower. Some special programs, like video encoders, do not need this help. They are already tuned to use the hardware perfectly.

Multithreaded process
Multithreaded process
381 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Multithreaded process.svg
Multithreaded process.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.