
- 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
What is a multithreading model in OS?
Multithreading is a process divided into a number of smaller tasks. Each task is represented or called it as a “Thread”. That means a thread is a lightweight of process. A number of such threads within a process executes at a time is called “multithreading”.
The operating system’s additional capability is supporting multithreading.
Based on the functionality, threads are divided into four categories and these are given below −
One process, one thread.
One process, multiple threads.
Multiple processes, one thread per process.
Multiple processes, multiple threads per process.
Let us see how the above functionality represents in the pictorial form −
One process, one thread − It is a traditional approach, in which the process maintains only one thread, so it is called a single threaded approach. For example − MS-DOS OS supports one thread, one process approach.
One process, multiple threads − Here, a process is divided into a number of threads. For example − JAVA runtime environment.
Multiple processes, one thread per process − An Operating system supports multiple user processes but only supports one thread per process. For example − UNIX operating system.
Multiple processes, multiple threads per process − Here, each process is divided into a number of threads. For example − Windows 2000, Solaris LINUX.
Differences
The major differences between process and threads are as follows −
Process | Thread |
---|---|
Process cannot share the same memory area that means it cannot share the address space. | Thread can share memory and files. |
It takes more time to create a process. | It takes less time to create a thread. |
It takes more time to complete the execution and more time for termination also. | It takes less time to terminate. |
Execution is very low | Execution is very fast. |
It takes more time to switch between two processes | It takes less time to switch between two threads. |
Implementing the communication between processes is a bit more difficult. | Communication between two threads is very easy to implement because the thread shares the memory. |
System calls are required to communicate with each other. | System calls are not required. |
Process is loosely coupled | Threads are tightly coupled. |
It requires more resources to execute. | It requires less resources that is why we usually call thread as a light weight process. |
Process are not suitable for parallel activities | Suitable for parallel activity. |
- Related Articles
- Difference Between Multitasking and Multithreading in OS
- What is multithreading in C#?
- What is a process scheduler in OS?
- What are multithreading models?
- Differentiate between shared memory and message passing model in OS.
- What is shared memory in the OS?
- What is message passing technique in OS?
- Multithreading in Java
- Multithreading in C++
- Multithreading in C#
- What is a BCG Model?
- What is a Data Model in DBMS?
- Multithreading in C\n
- Deadlock in Java Multithreading
- What is a Document Object Model?
