From: Alexander Nyberg <alexn@dsv.su.se>
To: Olivier Croquette <ocroquette@free.fr>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Scheduler: SIGSTOP on multi threaded processes
Date: Wed, 04 May 2005 21:10:22 +0200 [thread overview]
Message-ID: <1115233822.2562.21.camel@localhost.localdomain> (raw)
In-Reply-To: <4279084C.9030908@free.fr>
> On a 2.6.11 x86 system, I am SIGSTOP'ing processes which have started
> several threads before.
>
> As expected, all threads are suspended.
>
> But surprisingly, it can happen that some threads are still scheduled
> after the SIGSTOP has been issued.
>
> Typically, they get scheduled 2 times within the next 5ms, before being
> really stopped.
>
> Sadly, I could not reproduce that in a smaller example yet.
>
> As this behaviour is IMA against the SIGSTOP concept, I tried to analyze
> the kernel code responsible for that. I could not really find the exact
> lines.
>
> So here are my questions:
>
> 1. do you know any reason for which the SIGSTOP would not stop
> immediatly all threads of a process?
The following scenario is possible:
program1 with a thread thread1
1) you send SIGSTOP to program1
2) thread1 is now scheduled and run.
3) program1 is now run and before it is scheduled off it notices it has
a signal set, makes sure all threads in the group gets SIGSTOP set.
4) thread1 is now scheduled and run again. now before it is scheduled
off it will find a signal pending and set itself in SIGSTOP.
There are absolutely no guarantees when a signal will be delivered.
Signals are delivered asynchronously.
> 2. where do the threads get suspended exactly in the kernel? I think it
> is in signal.c but I am not sure exactly were.
do_notify_resume()
do_signal()
get_signal_to_deliver()
do_signal_stop()
finish_stop()
> 3. can you confirm that the bug MUST be in my code? :)
You'll have to use reliable mechanisms to achieve what you're looking
for.
prev parent reply other threads:[~2005-05-04 19:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-04 17:37 Olivier Croquette
2005-05-04 18:16 ` Richard B. Johnson
2005-05-04 19:16 ` Daniel Jacobowitz
2005-05-04 21:06 ` Alex Riesen
2005-05-05 0:42 ` Richard B. Johnson
2005-05-05 0:33 ` Richard B. Johnson
2005-05-05 0:45 ` Richard B. Johnson
2005-05-05 12:24 ` Richard B. Johnson
2005-05-05 13:14 ` Denis Vlasenko
2005-05-05 13:30 ` Andreas Schwab
2005-05-05 22:04 ` Miquel van Smoorenburg
2005-05-06 23:15 ` Problem while stopping many threads within a module Yuly Finkelberg
2006-04-20 8:43 ` shikha
2005-05-10 20:59 ` Scheduler: SIGSTOP on multi threaded processes Olivier Croquette
2005-05-10 21:12 ` Roland McGrath
2005-05-11 18:58 ` Olivier Croquette
2005-05-10 23:05 ` Alex Riesen
2005-05-05 1:04 ` Andy Isaacson
2005-05-04 19:10 ` Alexander Nyberg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1115233822.2562.21.camel@localhost.localdomain \
--to=alexn@dsv.su.se \
--cc=linux-kernel@vger.kernel.org \
--cc=ocroquette@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome