Q1. Explain how implementation of Threads is done in User Space and what are its advantages?
Ans. Put the threads package entirely in user space. The knows nothing about them. As far as the kernel is concerned, it is managing ordinary, single-threaded processes.
A user-level threads package can be implemented on an operating system that does not support threads.
The threads run on top of a run-time system, which is a collection of procedures that manage threads.
When threads are managed in user space, each process needs its own private thread table to keep track of the threads in that process. This table is analogous to the kernel’s process table, except that it keeps tracks only of the per-thread properties, such as each thread’s program counter, stack pointer, registers, state, and so forth. The thread table is managed by the run-time system. When a thread is moved to ready state or blocked state, the information needed to restart it is stored in the thread table, exactly the same way as the kernel stores information about processes in the process table.
Figure: A user-level thread package