Is there any prevention with user-level threads
My reasoning on this on modern operating systems:
-
A user-level thread is processed by a user-level process. The user process can push its threads to the CPU or shutdown it during the allocated time slice (quantum). However, the kernel cannot see the user-level thread: it just knows that a specific user process is running on its own time allocation.
-
When a thread enters its critical section, it requires a shared resource handled by the system. Thus, a system call is made.
-
However, when a thread makes a system call, all other threads in the parent process are blocked. This means that the downstream cannot preempt the blocking flow.
Hence, while preemption can occur with a user-level thread, priority inversion cannot.
Edit: After learning a little more, I found out that preemption on user-level threads depends on the thread model (i.e. the mapping of user-level threads to kernel-level threads) and their implementation. Will be updated after more information.
source to share
Based on my reading of MOS by AT, I figured the solution says this because preemption requires timer interrupts (the other way is inferior, which will never happen when executing a critical section) and there are no thread timer interrupts at the user level (at least , this was not discussed in the book). This does not mean that continuity cannot be implemented in user-level threads, as discussed here .
source to share