Threads package can be implemented in user space or in kernel space or in a multiplexed implementation.
Implementation of a thread package in a user space: In this process threads package is completely implemented in user space. The kernel has no information about the threads package and it handles single thread processes. Advantage of this process is that threads package can be used with an operating system which doesn’t support threads. Every thread has a private thread table in user space which stores program counter, stack pointer, registers, state, etc. of a thread. Thread table is handled by run time system. When threads are in user space each process can have a different scheduling algorithm. Disadvantages of threads in user space are that they block system calls and they cause page fault. Page fault happens when a program calls an instruction which is not in memory.
Implementation of a thread package in a kernel space: In this process, run time system is not required and there is no thread table for each thread in user space. All the threads are tracked by a thread table in kernel space. To create or kill a new thread, a kernel call is made by the thread. Blocking system calls and page fault problem is taken care of in this case. Disadvantage of this implementation is that processing overhead is high. Also, it cannot manage signals effectively.
Multiplexed implementation: This process involves multiplexing of user space threads on kernel space threads. This process has more advantages over individual user space threads and kernel space threads.