2005-03-10 04:17:30

by Dave Airlie

[permalink] [raw]
Subject: sched_setscheduler and pids/threads

Hi all,

I'm a bit confused over 2.6 threading with respects to real time
scheduling settings...

In 2.6 all my threads appear as a single PID, if I use chrt -p <pid>
will it set the scheduling priority for my main thread or for all
threads in the application?

Can I used the thread IDs from /proc/<pid>/task/ to chrt the other
threads in my app to different priorities?

Thanks,
Dave.


2005-03-10 04:37:06

by Robert Love

[permalink] [raw]
Subject: Re: sched_setscheduler and pids/threads

On Thu, 2005-03-10 at 15:12 +1100, Dave Airlie wrote:

> In 2.6 all my threads appear as a single PID,if I use chrt -p <pid>
> will it set the scheduling priority for my main thread or for all
> threads in the application?

For just the main thread (or the thread of whatever PID you give). You
need to set the PID of each thread individually. The "everything
appears as a single PID" is just an elaborate parlor trick. Wool pulled
over your eyes.

> Can I used the thread IDs from /proc/<pid>/task/ to chrt the other
> threads in my app to different priorities?

You can use the PID's in /proc/<pid>/task/, yes.

Or you can just set the PID of the main thread before it starts other
threads, or use chrt to launch the program, or use chrt to set the PID
of a shell script that starts the application: Scheduler properties are
inherited.

Best,

Robert Love