4 ms·
Here is a typical scenario: - Your AAC encoder runs UN CPU #1. - Your AAC encoder stalls on I/O. - The scheduler picks some other thread to run on CPU
by Someone 14y ago
Here is a typical scenario:
- Your AAC encoder runs UN CPU #1.
- Your AAC encoder stalls on I/O.
- The scheduler picks some other thread to run on CPU #1.
- The I/O request completes.
- A third thread, running on CPU #2, blocks.
- Your AAC encoder is the first waiting thread.
Should the scheduler:
- run your AAC encoder on CPU #2?
- run your AAC encoder on CPU #1,
and move the program happily running there to #2?
- wait until CPU #1 becomes available before running your AAC encoder again?
Keep in mind that 'the program happily running there' could very well be my AAC encoder.
Variations include the case where, by the time your I/O completes, CPU's #1 and #3 are available, but #1 is asleep. Should the scheduler wake it, so that your thread can stay on the CPU?
Your AAC encoder may be the most important process alive for you, but how is the scheduler to know that?
(Running processes you deem important at a nice level might help, but I do not know enough about current schedulers to know about that)
- robotresearcher 14y ago> Keep in mind that 'the program happily running there' could very well be my AAC encoder. This is rare on Windows client machines. Does anyone know if desktop Windows' scheduler uses different rules to their server OS to exploit this?
- Someone 14y agoWell, it also could be your MP3 player, the game you are playing, or whatever. Server OSes typically use different schedulers or scheduler settings than desktop ones; Windows is not different. This starts with using larger time quantums. http://download.microsoft.com/download/1/4/0/14045A9E-C978-47D1-954B-92B9FD877995/97807356648739_SampleChapters.pdf http://download.microsoft.com/download/1/4/0/14045A9E-C978-4...: "On client versions of Windows, threads run by default for 2 clock intervals; on server systems, by default, a thread runs for 12 clock intervals" The windows scheduler also is aware of the GUI, and raises priority of threads handling the user interface. Some things the kernel and/or user mode code do: "Threads that own windows receive an additional boost of 2 when they wake up because of windowing activity such as the arrival of window messages . The windowing system (Win32k .sys) applies this boost when it calls KeSetEvent to set an event used to wake up a GUI thread ." "Client versions of Windows also include another pseudo-boosting mechanism that occurs during multimedia playback . Unlike the other priority boosts, which are applied directly by kernel code, multimedia playback boosts are actually managed by a user-mode service called the MultiMedia Class Scheduler Service (MMCSS), but they are not really boosts—the service merely sets new base priorities for the threads as needed" (Much) more info in the above-mentioned PDF.