Process vs. Thread priority.
-
If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/
-
If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/
-
If I have two processes with normal priority, and each has a thread running with different priorities like this: Process 1 |- Thread 1 (High Priority) Process 2 |- Thread 2 (Normal Priority) I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority. That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)? Any ideas? Thanks. -- Simon Steele Programmers Notepad - http://www.pnotepad.org/
The Base Priority of a thread is determined by both the process priority class, and the thread priority. It's just two different mechanisms (one to weight processes in the system, one to weight threads inside one process) Thread 1 will (almost) always get scheduled first when both are waiting for an event or similar. The scheduler always schedules the thread of the highest priority that is ready to run. So Thread 1 will starve thread 2, if it doesn't give up processor time or a second CPU is available. The one exception is: Input goes to Thread 2. When input waits in the queue for a thread, it's priority is temporarily boosted.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen