- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Single-threaded and Multi-threaded Processes
Single threaded processes contain the execution of instructions in a single sequence. In other words, one command is processes at a time.
The opposite of single threaded processes are multithreaded processes. These processes allow the execution of multiple parts of a program at the same time. These are lightweight processes available within the process.
Multithreaded Processes Implementation
Multithreaded processes can be implemented as user-level threads or kernel-level threads. Details about these are provided using the following diagram −
- User-level Threads
The user-level threads are implemented by users and the kernel is not aware of the existence of these threads. It handles them as if they were single-threaded processes. User-level threads are small and much faster than kernel level threads. Also, there is no kernel involvement in synchronization for user-level threads.
- Kernel-level Threads
Kernel-level threads are handled by the operating system directly and the thread management is done by the kernel. The context information for the process as well as the process threads is all managed by the kernel. Because of this, kernel-level threads are slower than user-level threads.
Advantages of Multithreaded Processes
Some of the advantages of multithreaded processes are given as follows −
- All the threads of a process share its resources such as memory, data, files etc. A single application can have different threads within the same address space using resource sharing.
- It is more economical to use threads as they share the process resources. Comparatively, it is more expensive and time consuming to create processes as they require more memory and resources.
- Program responsiveness allows a program to run even if part of it is blocked using multithreading. This can also be done if the process is performing a lengthy operation.
- In a multiprocessor architecture, each thread can run on a different processor in parallel using multithreading. This increases concurrency of the system. This is in direct contrast to a single processor system, where only one process or thread can run on a processor at a time.
Disadvantages of Multithreaded Processes
Some of the disadvantages of multithreaded processes are given as follows −
- Multithreaded processes are quite complicated. Coding for these can only be handled by expert programmers.
- It is difficult to handle concurrency in multithreaded processes. This may lead to complications and future problems.
- Identification and correction of errors is much more difficult in multithreaded processes as compared to single threaded processes.
- Related Articles
- Major issues with Multi-threaded Programs
- Threaded Binary Trees in Data Structure
- C++ program to Implement Threaded Binary Tree
- Inorder Traversal of a Threaded Binary Tree in C++
- Convert a Binary Tree to Threaded binary tree | Set 1 (Using Queue) in C++
- Explain Single and multi-tire architectures of ODBC?
- Difference between Single Channel and Multi-Channel Marketing
- Differentiate between a single processor and a multi-processor.
- What is the difference between single-line and multi-line comments in JavaScript?
- Running Multi-Line Shell Code at Once From Single Prompt
- JavaScript function that takes a multidimensional and a single array, and finds matches of the single array in the multi-d array
- Set Database From Single User Mode to Multi User in SQL?
- How to Map multi-dimensional arrays to a single array in java?
- Fashion Design and Development Processes
- How to Find the List of Daemon Processes and Zombie Processes in Linux
