Nepedia
Back to Discover
Fluent Reader
💻

Thread (computing)

technology Maturity 7-9 Next article →

Computers perform many tasks at the same time to stay fast. One way they do this is through a thread of execution. A thread is the smallest sequence of programmed instructions that a scheduler can manage.

Concepts- Program vs. Process vs. Thread
Concepts- Program vs. Process vs. Thread

Most threads live inside a larger unit called a process. While a process is a heavy unit of resources, a thread is a unit of execution. Think of a process as a whole office building. A thread is like a worker inside that specific office.

Multithreaded process
Multithreaded process

Threads work by sharing what the process already owns. Multiple threads in one process share the same executable code. They also share the values of variables and memory. This sharing makes it very easy for threads to communicate. They can simply use the data and files they already have. However, this sharing also means they can cause trouble for each other. If one thread performs an illegal operation, it can crash the entire process. This would stop all the other threads in that application too.

People have been working with these ideas for a long time. In 1967, IBM used something called "tasks" in its OS/360 system. A person named Victor A. Vyssotsky is credited with using the term "thread" in 1966. Later, the Mach implementation of threads was described in the summer of 1986. Windows NT was the first version of Windows to use threads when it came out in 1993. In 1995, the IEEE created the pthreads API. This helped make multithreaded programming work across different Unix-like systems.

There are many different types of threads used in computing. Kernel threads are managed by the operating system itself. They are a lightweight unit of scheduling. User threads are managed in userspace, which means the kernel does not even know about them. Some user threads are even called "green threads" when used by virtual machines. There are also fibers, which are very light units of scheduling. Fibers use cooperative scheduling, so they must explicitly yield to let others run.

Understanding threads helps us see how modern hardware works. Most computers today use CPUs with multiple cores. In 2002, Intel added support for multithreading to the Pentium 4 processor. They called this "hyper-threading." By the year 2005, new dual-core processors arrived from Intel and AMD. On a single-core system, the computer uses "time slicing" to switch between threads quickly. This happens so fast that it feels like they run at the same time. On multi-core systems, different threads can truly run in parallel.

419 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (2)
File:Multithreaded process.svg
Multithreaded process.svg
File:Concepts- Program vs. Process vs. Thread.jpg
Concepts- Program vs. Process vs. Thread.jpg
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.