Query on operating systems thread concept


Consider a user level threading library that multiplexes N > 1 user level threads over M ≥ 1 kernel threads. The library manages the concurrent scheduling of the multiple user threads that map to the same kernel thread internally, and the programmer using the library has no visibility or control on this scheduling or on the mapping between user threads and kernel threads. The N user level threads all access and update a shared data structure. When (or, under what conditions) should the user level threads use mutexes to guarantee the consistency of the shared data structure?

(A) Only if M > 1
(B) Only if N ≥ M
© Only if the M kernel threads can run in parallel on a multi-core machine.
(D) User level threads should always use mutexes to protect shared data.