Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 5 Sep 2019 02:14:36 +0000
From: "zhaohang (F)" <zhaohang14@...wei.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: src/thread/pthread_create: Why prio of child thread is set by
 himself

In the function pthread_create, father thread will wait child if attr._a_sched is set, after SYS_clone is finished.Child thread will set his prio in entry 'start', and then wake father thread to continue.

But consider this kind of situation, there are three threads: A with prio 51, B with prio 30, and C with prio 20 created by A, and there is only simplest sched policy 'FIFO'.

When system starts, A is running because A is higher than B, then A uses pthread_create to create C. After C is cloned, A wait for C to set prio and wake him up, but after C set his prio to 20, B will be sched. And if B won't exit, A and C will never get sched, even if A is higher than B. Maybe this is a kind of priority inversion.

So why prio of child is set by himself rather than father? If prio of child is set by father, something will go wrong? Or other considerations?

Thanks,

Zhao Hang

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.