
- Operating System Tutorial
- OS - Home
- OS - Overview
- OS - Components
- OS - Types
- OS - Services
- OS - Properties
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling algorithms
- OS - Multi-threading
- OS - Memory Management
- OS - Virtual Memory
- OS - I/O Hardware
- OS - I/O Software
- OS - File System
- OS - Security
- OS - Linux
- OS - Exams Questions with Answers
- OS - Exams Questions with Answers
- Operating System Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Benefits of Multithreading in Operating System
In computers, when multiple threads of a process are executed independently by sharing the same resources, it is called multithreading. Read through this article to learn the benefits of multithreading in operating systems.
What is Multithreading in OS?
In computers, a program in execution is referred to as a process. When a larger process is sub-divided into smaller processes, then each sub-process is termed as a thread.
Technically, a separate execution path within a computer program is called a thread. In simple words, a thread is a light-weight process that can be scheduled by the operating system and executed by the processor along with other threads. Threads are created and managed by the operating system to reduce the load on the processor and for efficient utilization of resources.
Multithreading, as the name implies, is a method of running multiple threads concurrently. For example, playing a video while downloading it at the same time is an example of multithreading.
Multithreading allows to run several parts of a program at the same time. Each of these parts is called a thread. Therefore, multithreading is the function that allows to execute a large process by splitting it into smaller and lightweight processes. Multithreading increases the processor utilization by multitasking. Another example of multithreading is word processing, in which we create a document and the word processor application keeps checking the document for grammatical and spelling mistakes.
Let us now discuss the advantages of multithreading.
Benefits of Multithreading in Operating System
All the major advantages of multithreading in operating system are described in the following sections.
Resource Sharing
In multithreading, the treads are able to share the resources and memory of any other process. Hence, multithreading allows any program or application to perform multiple tasks inside the same address space.
There are two techniques to share resources namely, message passing and shared memory. The programmer has to be explicitly organize these techniques. However, the threads can share the memory and resources of the process by default to which they belong.
Increased Responsiveness
Multithreading increases the user responsiveness. For example, in an interactive application, user can run a section of the program even if another section is blocked or engaged in a length process.
Consider another example, when a web browser that is multithreaded allows the user to interact in one thread while a video is playing in another thread. Consequently, the user does not have to wait for the whole webpage to load. Thus, multithreading enhances the user responsiveness of the application.
Effective Utilization of Multiprocessor Architecture
The advantages of multiprogramming are greatly increased in a multiprocessor architecture machine, where multiple threads are running in parallel on multiple processors. In case of a single threaded process, it is not possible to sub-divide it into smaller processes to execute by different processors regardless of how many processors are present there. Thus, multithreading increases parallelism on a multiprocessor architecture system.
Economical
The allocation of memory and resources during creating a process is an expressive procedure as it requires time and space. Thus, creating and managing a process is more time consuming and costly as compared to threads. Hence, multithreading becomes economical because it distributes the resources of the process.
Improved Communication
In multithreading, we can use thread synchronization functions to enhance inter-process communication.
Enhanced Concurrency
Multithreading can enhance the concurrency of a multi-CPU machine. This is because the multithreading allows every thread to be executed in parallel on a distinct processor.
Minimized Utilization of System Resources
As threads are light weight processes, thus they have a considerably minimal influence on the resources of the system. Hence, in the case multithreading, the overhead of creating and managing the threads is lower as compared to a normal process.
Conclusion
Although multithreading offers several advantages, it has its own share of drawbacks too. For example, multithreading creates the context switching overhead, it requires thread or process support, it requires careful synchronization of threads. Sometimes, it may consume large space due to blocked threads, etc.
- Related Articles
- File system Implementation in Operating System
- Difference Between Network Operating System and Distributed Operating System
- Semaphores in Operating System
- Buffering in Operating System
- Concurrency in Operating System
- Kernel in Operating System
- Livelock in Operating System
- What are system calls in Operating System?
- Structure of Unix Operating System
- Views of the Operating System
- Operating System Structure
- Operating System Operations
- Layered Operating System
- Hybrid Operating System
- Operating System Generations
