Computer Science; Operating Systems; Computer Engineering
Multithreading operating systems (OSs) are OSs designed to increase the speed of computing by working on multiple threads, which are parts of a programming sequence. There are various types of multithreading processes, based on how various types of threads are handled by the OS. Multithreading is beneficial for increasing computing speed, but makes programming more complicated for software designers and creates additional potential for application errors.
Multithreading is a way of increasing operating system (OS) efficiency. It does this by dividing the way that the OS handles processes, which occur when a computer executes instructions within a computer program. Multithreading OSs divide processes into subprocesses called threads. Threads are the smallest part of a programmed process that can be managed independently. In multithreading, the OS operates on multiple threads at the same time, or switches rapidly between threads. This essentially allows the OS to work on multiple processes simultaneously or to finish a process more efficiently. Multithreading is a form of multitasking that occurs within applications. Multitasking is the act of handling more than one task or application at the same time at the system level.
Processes are the building blocks of applications and all computing functions. All processes within a computer are managed by a scheduler. The scheduler is typically built into the OS and determines when and in what order various tasks should be completed. Each program requires a certain amount of memory, representing the resources available to complete the task. The amount of memory allocated to a process, application, or program is called the address space. To manage ongoing processes, OSs engage in context switching. Context switching means that a process or a thread within a process may be essentially put on hold while the computer switches between tasks.
While each process and each application requires its own address space, threads share the same address space. The way that OSs handle threads depends on the computer's processor. The processor is the essential circuitry that processes tasks through a system of electrical capacitors and transistors. Single-processor computers switch back and forth between threads so rapidly that the threads appear to be processed at the same time. Multicore processors can process more than one thread at a time by dividing threads between processors. Because threads share the same resources and address space, switching between threads is much easier for most computers than switching between processes.
There are two basic types of threads, user threads and kernel threads. Threads can also be classified according to their complexity. The term fiber is used for extremely simple threads that require little processing. User threads are those that are created by user interaction or are built into a program while kernel threads are built into the OS. During processing each user thread is linked to a kernel thread. This provides a link between the computer's central processing and the application. 3 Science Reference Center™ Multithreading Operating Systems
In the one-to-one model, each user thread is linked to a specific kernel thread. Older OSs, like Windows 95 and XP, use a one-to-one model. This model places a limit on the number of threads that can be used to handle a process. In the many-to-one model, all application threads are mapped to a single kernel thread. This model is widely used in single-processor computers because multiple threads cannot be scheduled simultaneously. In a many-to-many model, user threads can be mapped onto an equal or smaller number of kernel threads. The many-to-many OS model is best for multiprocessor computers because it allows the computer to process multiple user threads at once.
Multithreading allows a program to continue running in the background while still accepting new user input or while another task is being completed. This helps to make programs more responsive. Multicore processors have gradually become the norm in personal computing, so designing OSs to handle multithreading provides faster processing overall. Dividing processes into threads is also more efficient than running multiple instances of an entire program. Data from multiple users or different inputs can be integrated more efficiently through threads than through separate processes. This is because threads already share programs, code, and address space, while processes are usually independent of one another.
Creating hardware and software for multithreading is difficult, however, and coding for multithreading applications requires specialized knowledge. In some cases, it can be more difficult to locate and identify errors in multithreading systems. Problems in the code or errors in multithreading systems can also lead to system lag or can crash an entire process. Errors in the execution of any single thread can threaten the progress of an entire process. Therefore, multithreading essentially adds a variety of new variables that can lead to system-wide errors and processing issues.
—Micah L. Issitt
“About Threads and Processes.” MSDN.Microsoft. Windows, n.d. Web. 15 Mar 2016.
Aravind, Alex A., and Sibsankar Haldar. Operating Systems. Upper Saddle River: Pearson, 2010. Print.
Ballew, Joli, and Ann McIver McHoes. Operating Systems DeMYSTiFieD. New York: McGraw, 2012. Print.
“Differences between Multithreading and Multitasking for Programmers.” NI. National Instruments, 20 Jan. 2014. Web. 15 Mar 2016.
Herlihy, Maurice, and Nir Shavit. The Art of Multiprocessor Programming. New York: Elsevier, 2012. Print.
Tanenbaum, Andrew S., and Herbert Bos. Modern Operating Systems. 4th ed. New York: Pearson, 2014. Print.