Tutorialspoint

1 Answer
David Meador
, 10 Views

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:

Multithreaded Processes
  1. User-level Threads
  2. 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.

  3. Kernel-level Threads
  4. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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:

  1. Multithreaded processes are quite complicated. Coding for these can only be handled by expert programmers.
  2. It is difficult to handle concurrency in multithreaded processes. This may lead to complications and future problems.
  3. Identification and correction of errors is much more difficult in multithreaded processes as compared to single threaded processes.

Advertisements