Subj : Re: pthread priority in Linux 2.4 Kernel To : comp.programming.threads From : David Hopwood Date : Wed Aug 03 2005 12:44 am David Schwartz wrote: > "forSale" <@hotmail.com> wrote: > >>Now Since thread 2 has higher priority than thread1. Thread1 should never >>get executed once thread2 start to run. Why is the thread1 getting >>executing again. > > Your assumption is definitely wrong. Just because one thread has higher > priority than another, it doesn't mean the other thread won't run! It just > means that if the system ever has to choose which of the two threads to run, > it will choose the higher priority one. It doesn't even mean that. This is true, approximately (for both the old and the O(1) Linux schedulers), if one or both of the threads are "realtime" threads; otherwise what determines which thread is chosen is the dynamically computed 'goodness' value, which may be quite different from the static priority. -- David Hopwood .