need to implement many to one user level threads where in we have multiple threads in user level and a single thread in kernel level. For this one should create a own thread library. All the threads should execute on the same kernel thread , so only one user thread can execute at one time. The threads manager include a preemptive round-robin [login to view URL] does not yield during its time-slice, it will be preempted and one of the other ready threads will be [login to view URL], the preempted and resumed thread will change its state.
The execution context management can be using setcontext,getcontext,makecontext,swapconntext
To implement preemptive scheduling, we need to set a timer, and register a timer
handler that will act as the thread scheduler for the library and figure out how to suspend
the running thread and resume a thread from the ready queue.