As far as I can tell, both use:
- Multilevel feedback queue
- Priority levels (different range)
- Both manage threads and not the process
But what are the big differences?
migrated from stackoverflow.com Apr 20 '12 at 4:19
This question came from our site for professional and enthusiast programmers.
According to Scheduling Priorities at MSDN:
I believe this thread scheduler describes an algorithm called multilevel queue, which is a much simpler scheduling algorithm than multilevel feedback queue. Note that Windows' process scheduler uses multilevel feedback queue, according to Wikipedia. Since Windows 7 and Windows Server 2008 R2, there is also User-Mode Scheduling which lets processes manage their own threads scheduling.
As mentioned by others, Linux treats process and threads the same from scheduling perspective. Process/thread scheduling in Linux is configurable, there are various scheduling algorithms and some can be configured by recompiling the kernel:
Note that default above means default in vanilla kernel. Some distros ship with a default kernel that is preconfigured to use different default scheduler.
In addition to the scheduling algorithm, there are also scheduler policies: SCHED_FIFO, SCHED_BATCH, SCHED_IDLE, SCHED_OTHER, and SCHED_RR; which can be changed at runtime which describes the kind of workload that a process has.
The current default scheduler Completely Fair Scheduler, uses a red-black tree to maintain scheduling fairness. From Inside the Linux 2.6 Completely Fair Scheduler:
So main differences:
If you are refering to the kernel scheduler (and not a periodic task scheduler like some comments suggest), in Linux is pretty easy: in terms of scheduling, Linux makes no difference between threads and processes. From the kernel point of view, they are just scheduling units; the difference relies in the weight of the context switch. This is sometimes called a one-to-one threading model.
As there is less information available regarding Windows internals, little can be said. However, Windows has historically differentiated between processes and threads so it is more likely that they are treated differently in terms of scheduling.
C2H5OH, Why would you say there's no documentation on Windows Internals when everything is available? Beats me... You can read the most of the basics here, http://msdn.microsoft.com/en-us/library/windows/desktop/ms684259(v=vs.85).aspx
There's an article on Wikipedia (Threads (computing)) which states most of the differences, but without cited sources, so...