Assume a multiprocessor architecture with an OS which may or may not support kernel-level threads
Correct me where I go wrong:
- If a thread library is implemented entirely in user space, then the management of threads is done in user space (creation, thread tables, stack info, ect).
- Thus, even though a process may have multiple user threads, the kernel only sees 1, single-kernel-threaded process.
- Thus, the kernel schedular assigns CPU usage time to the process as a whole; the user-space thread library is responsible for time-slicing this CPU time amongst it's user threads.
- (corollary 1) process A with 20 user-threads will get same priority as process B with 1 user-thread, and so the threads in process A get approximately 1/20th CPU time as thread in process B
- (corollary 2) user threads within the same process will never be hyper-threaded (i.e. 2 threads executing on separate CPU's at the same time)