Training
×

Time Slicing

What if there is more than one thread with the same priority as the running thread? It makes sense to alternate between these to give them all a fair chance -- they are equally important! We call this time-slicing (or time-sharing). Such scheduling is most important when multiple users are served by one system, as in some UNIX implementations. There are very sophisticated implementations of such time-slicing schedulers, that remember the core usage of a thread: if a thread tends to use only a small part of its time slice, it could be preferred.  Very often in time-slicing systems we see that the programmer-defined thread priority is not used absolutely, but rather as a hint.
In a single user (or no-user) system it may still occur that the same priority is used more than once, so time-slicing is also a choice for OSs that are not purely intended for multiple users.