Sometimes threads fell that they run long time, and they give their turns to another threads by means of thread scheduling procedure.

1) I wonder what happens if a thread does not want to stop itself, and it wants to continue running.

2) If another thread want to take the turn of the thread which do not want to stop, what happens ?


In most modern operating systems, including Linux, task (process/thread) scheduling is preemptive – controlled by the kernel. A task cannot choose not to stop and cannot choose to take the turn of another task. In general, tasks are oblivious to the fact that CPU scheduling is even happening.

Not the answer you're looking for? Browse other questions tagged or ask your own question.