Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, May 2007
thread-priorities on linux based systems


Message 1 in thread

Hi list!

We are working on an application, which uses different threads.
We have two Threads, which we expect to run with high priority and 
not be interupted too often: The GUI Thread, and a Protocol Thread, 
which receives data from our peripheral devices and acknoleges it.
Several other threads perform less time critical jobs and should run 
with low priority. However, it happens that those threads 
simultaniously get a lot of work to do and so starve the GUI and the 
Protocol thread.
So my questions is, if there is a possibility to use threads with 
different 
priorities to prevent the two important threads from being interrupted too 
often...

thanks in advance for any hints!

kind regards,
Andreas

Message 2 in thread

On Friday 18 May 2007 19:54:34 andreas.sumper@xxxxxxxxxxxx wrote:
> Hi list!
>
> We are working on an application, which uses different threads.
> We have two Threads, which we expect to run with high priority and
> not be interupted too often: The GUI Thread, and a Protocol Thread,
> which receives data from our peripheral devices and acknoleges it.
> Several other threads perform less time critical jobs and should run
> with low priority. However, it happens that those threads
> simultaniously get a lot of work to do and so starve the GUI and the
> Protocol thread.
> So my questions is, if there is a possibility to use threads with
> different
> priorities to prevent the two important threads from being interrupted too
> often...

In theory, it is possible, but in practice it turns out to have negative 
consequences: 
http://www.trolltech.com/developer/task-tracker/index_html?id=127426&method=entry

We tried to make thread priorities work on Linux systems (the default 
scheduling policy on Linux doesn't allow inter-thread priorities), and when 
trying to use a different scheduling policy, every thread would preempt every 
other process and thread in the entire system as long as the thread was 
runnable (i.e. not sleeping).

:/

-- 
 [ signature omitted ] 

Message 3 in thread

Hi Bradley!

first of all thanks for your answer!

Right now, we are trying to use two processes. But it is too early to 
tell, if this will solve the problem...

never the less thanks!

kind regards,
Andy

Bradley T Hughes <bhughes@xxxxxxxxxxxxx> wrote on 21.05.2007 08:02:13:

> On Friday 18 May 2007 19:54:34 andreas.sumper@xxxxxxxxxxxx wrote:
> > Hi list!
> >
> > We are working on an application, which uses different threads.
> > We have two Threads, which we expect to run with high priority and
> > not be interupted too often: The GUI Thread, and a Protocol Thread,
> > which receives data from our peripheral devices and acknoleges it.
> > Several other threads perform less time critical jobs and should run
> > with low priority. However, it happens that those threads
> > simultaniously get a lot of work to do and so starve the GUI and the
> > Protocol thread.
> > So my questions is, if there is a possibility to use threads with
> > different
> > priorities to prevent the two important threads from being interrupted 
too
> > often...
> 
> In theory, it is possible, but in practice it turns out to have negative 

> consequences: 
> http://www.trolltech.com/developer/task-tracker/index_html?
> id=127426&method=entry
> 
> We tried to make thread priorities work on Linux systems (the default 
> scheduling policy on Linux doesn't allow inter-thread priorities), and 
when 
> trying to use a different scheduling policy, every thread would preempt 
every 
> other process and thread in the entire system as long as the thread was 
> runnable (i.e. not sleeping).
> 
> :/
> 
> -- 
> Bradley T. Hughes - bhughes at trolltech.com
> Trolltech ASA - Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, 
Norway