Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#108 Thread Scheduling Policy support

open
nobody
Other (7)
5
2012-09-14
2009-06-14
Chris Love
No

The ThreadImpl class for POSIX systems is setting the scheduling policy of SCHED_OTHER. On Linux this is the default scheduling policy and there are in fact no priorities supported (Min 0, Max 0). I don't have access to a Solaris box right now so I can't say for sure what the behavior is there. I'd like to see support for SCHED_FIFO or SCHED_RR, where priorities can actually be specified. SCHED_FIFO or SCHED_RR are going to be a lot more applicable to embedded/soft real-time applications.

The downside to defaulting to SCHED_FIFO or SCHED_RR is the permissions that may be required to set the scheduling policy or priority.

Could the notion of scheduling policy be exposed as part of the Thread interface, even though support would vary by OS (Windows obviously doesn't support it, and support will vary depending on the level of POSIX support of other OSes):

class Thread {
...
enum Policy {
POLICY_OTHER,
POLICY_FIFO,
POLICY_RR
};

Policy getPolicy() const;

void setPolicy(int policy);

...
};

Discussion