Can my thread help the OS decide when to context switch it out?

Posted by WilliamKF on Stack Overflow See other posts from Stack Overflow or by WilliamKF
Published on 2010-05-27T04:01:49Z Indexed on 2010/05/27 4:11 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

I am working on a threaded application on Linux in C++ which attempts to be real time, doing an action on a heartbeat, or as close to it as possible.

In practice, I find the OS is swapping out my thread and causing delays of up to a tenth of a second while it is switched out, causing the heartbeat to be irregular.

Is there a way my thread can hint to the OS that now is a good time to context switch it out? I could make this call right after doing a heartbeat, and thus minimize the delay due to an ill timed context switch.

© Stack Overflow or respective owner

Related posts about c++

Related posts about linux