If I have a process that contains 3 threads and theses threads are running concu
ID: 3858118 • Letter: I
Question
If I have a process that contains 3 threads and theses threads are running concurrently with a quantum assigned by the CPU to the parent process of the 3 threads, what happens if instead of have one kernel thread for 3 user threads, I have 3 kernel threads to 3 user threads? Does that mean that the parent process of the 3 threads gets 3 times the quantum time? If I have a process that contains 3 threads and theses threads are running concurrently with a quantum assigned by the CPU to the parent process of the 3 threads, what happens if instead of have one kernel thread for 3 user threads, I have 3 kernel threads to 3 user threads? Does that mean that the parent process of the 3 threads gets 3 times the quantum time?Explanation / Answer
A Kernel thread, sometimes called a LWP ( light weight process) is created and scheduled by the kernel. Kernel threads are often more expensive to create than the user threads and the system calls to directly create kernel threads are very platform specific.
A User thread is normally created by a threading library and scheduling is managed by the threading library itself. All user threads belong to the process that created them. The advantages of user thread is that they are portable. The major difference can be seen when using multiprocessor systems, user threads completely managed by the threading library can't be ran in parallel on the different CPUs, although this mean that they will run fine on uniprocessor systems. Since kernel threads use the kernel scheduler, different kernel threads can run on different CPUs. Many system implement threading differently.
A many-to-one threading model maps many user processes directly to one ker el thread, the kernel thread can be thought as the main process.
If instead of having one kernel thread for 3 user threads, we have 3 kernel threads to 3 user threads that is in our case A one-to-one threading model maps each user thread directly to one kernel thread, this model allows parallel processing on the multiprocessor system. Each kernel thread can be thought of as a Virtual Process which is managed by the scheduler. This help decrease the time required to complete the process but will increase the over all cost of the process.
It is to note that in user thread there is never parallel execution. In kernel threads, they can be parallel execution. If there are multiple processor. On a single processor system, there is not much advantage to using kernel threads over single threads.
The period of time for a process is allowed to run in a preemptive multitasking system is generally called the time slice or quantum. The scheduler is run once every time slice to choose the next process to run therefore each user thread will have its own time hence parent process will have 3 times the quantum time.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.