On Fri, Aug 16, 2013 at 12:33, Mike Belopuhov wrote:
> On 16 August 2013 09:23, Ted Unangst <t...@tedunangst.com> wrote:
>> Actually, here's my concern. There's only one timeout for the process.
>> What happens when two threads are running on two CPUs? Is there a
>> guarantee that cpu0 will both set and execute the timeout before cpu1
>> sets it, or is there a race where cpu1 will fail to send the signal to
>> its thread because cpu0 has already processed the timeout?
>>
> 
> softclock and hence the timeout processing is done only by the cpu0
> currently.

That's really good to know. I couldn't remember if it was hardclock or
softclock or what exactly.

In that case, guenther, I think your diff is incorrect. The thread
running on cpu0 may not have been the thread running when the timer
expired. And if the thread on cpu0 is an unrelated process, we're back
to semi random delivery. If you look at my diff again, I didn't actually
create a timer per thread, only a timeout, and the timeout is only
used as a trampoline to get the proc argument from hardclock to
psignal.

(I think your diff may make sense for other reasons, but it's not
always going to send sigprof to the right thread.)

Reply via email to