Sample program in pthread to simulate the thread priority

Consider thread 1 has the higher priority than thread 2.

Is there is any sample program to simulate that thread 1 has taken the highest priority when compared to thread2?

I encountered this question because there is an option called thread priority in pthreads.

As per my knowledge thread priority is used by OS for scheduling policy and there is no control on programmer.

Is my understanding correct?


Source: c++

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.