Question & Answer
Question
How do you set the Linux thread priority in IBM Rhapsody?
Cause
You are setting the CG.Class.ActiveThreadPriority property but the property appears to have no effect and the thread priority does not change when the executable is run.
Answer
The CG.Class.ActiveThreadPriority property will set the thread priority using
POSIX API method pthread_setschedparam (see LinuxThread::setPriority()
in Share/LangCpp/oxf/LinuxOS.cpp) but the Linux OS will ignore this priority as the thread
scheduling scheme is set to the default SCHED_OTHER policy.
Therefore, it is the user's responsibility to explicitly and directly
change the scheduling policy. Once changed to a real time
scheduling policy the ActiveThreadPriority property will take effect.
Note that the specific system thread priority range should be checked
with sched_get_priority_min and sched_get_priority_max. Also, note that
some of the scheduling policies such as SCHED_FIFO and SCHED_RR require
root permission on the running thread.
Further information can be found in the POSIX API documentation.
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg22013129