In: Computer Science
Threads: Assume a multithreaded application using user level threads mapped to a single kernel level thread in one process (Many to one model). Describe the details of what happens when a thread (i.e. thread 1) executes a blocking system call (5 points). Describe what happens when thread 1 yields control to another user level thread, namely thread 2, in the same process. (NOTE: include the following in your description: what state is saved?, where is it saved? What state is restored right after saving current context?, etc)
Thread 1 blocking system call:
Thread 1 to thread 2 ctsw
Assuming a multithreaded application using user level threads mapped to a single kernel level thread in one which is
a Many to one multithreading model.
1.In Many to one multithreading model ,When thread 1 executes a blocking system call, the entire process will be blocked, Only one thread can access the kernel at a time , so multiple thread are unable to run in parallel on multiprocessors.
2.When thread 1 yields control to another user level thread which is thread then the CPU switches form executing thread 1 to execute another, the CPU needs to save the state of the thread which is nothing but local data,program pointer etc. of the thread 1 and load or restore the local data, program pointer etc. of the thread 2 to execute. which is called Context Switching Overhead.SInce in many to one mutlithreading model only one thread can access the kernel at a time so thread 2 can access the kernel but now thread 1 can't access the kernel at the same time.