Skip to contentSkip to conversation

sched_setscheduler and pids/threads

DISCUSSION Dave Airlie 2 participants 2 messages Mar 10, 2005

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 3 lines · Dave Airlie

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.

Quoted 2 lines

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