Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A middleweight thread is an instance of a sequence of code that works as a unit. This is normally done on behalf of a single user, transaction or message in a computer program. Threads are sometimes described by weight, which refers to the amount of contextual information that must be saved by the thread in order to make it useful to the system as a reference.
Modern OS kernels are considered middleweight threads because multiple threads can exist in a single address space. This reduces the amount of context that needs to be saved for each one, significantly decreasing the switching time. In contrast, a Unix process is considered a heavyweight thread. Most user-level threads are considered lightweight threads.
A thread and a task are very similar and are often confused. The OS considers a running program a task, giving each task a turn at performing an operation. If a program requests that a file be saved, the OS creates a thread. Most of today’s operating systems support multitasking and multithreading to provide efficient application processing.