开发者

Are equal time slices given to same-priority processes?

I know this is dependant on the operating system, but in modern operating syst开发者_运维知识库ems, are equal time slices given to threads/processes of the same priority, or are there other factors involved?


If the threads are doing I/O, waiting on synchronization mechanisms, or are going to sleep, they can use less (and sometimes more) than the timeslice they would use doing straight computation. The OS tries its best to give threads with identical thread/process priority the same quantum, but in reality the actual time given can vary.

For example, a thread that spends practically its entire (wall) time sleeping waiting on an exit event is going to be given less time, on average (over its total run), than one of equal priority that is doing compuation for the same amount of (wall) time.


In Linux for equal-priority processes, the preemptive scheduler
runs the process waiting the longest.

In Windows it's FIFO queue at each priority level and a thread
can switch priority level queues:

– if thread interrupted because time slice is up, priority lowered
– if interrupted to wait on I/O event, priority raised
– favors I/O-bound over CPU-bound threads
– for I/O bound threads, priority raised more for interactive waits (e.g. keyboard, display) than for other I/O (e.g. disk)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜