pthread_setprio seems to have no effect on a Raspberry

John Baldwin jhb at freebsd.org
Tue Oct 20 18:32:43 UTC 2015


On Saturday, August 01, 2015 02:24:16 PM Erich Dollansky wrote:
> Hi,
> 
> I wondered that a multi threaded program of mine behaved strangely on a
> Raspberry B+. So, it is the old single core version. Not matter what
> priorities I give to two threads, I get the same result.
> 
> While one thread generates messages and activates a condition, the
> second thread reads the condition with pthread_cond_wait.
> 
> I assume that on a single core system the reading thread should only
> become active after the condition is set ejrm the feeding thread has a
> lower priority than the reading thread.
> 
> Reality is that the feeding thread is writing first all messages and
> the reading threads starts reading them only after the feeding thread
> stops feeding no matter which thread has the higher priority. I used
> priority values like + and - 100, + and - 1, 0 and +1, 0 and -1 and 1
> and 2 in all possible combinations.
> 
> When I run the same source on a multi core x86, it looks like one core
> is generating while another core is reading. This is what I would
> expect under these condition.
> 
> All other settings for the two threads are default.
> 
> Does anyone have an idea?

If you use cpuset to restrict the x86 version to a single thread does it
exhibit the same behavior as on the Pi?  (e.g. cpuset -l 1 /my/program)

-- 
John Baldwin


More information about the freebsd-threads mailing list