mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Eric Smith" <eric@brouhaha.com>
To: linux-kernel@vger.kernel.org
Cc: "Bart Van Assche" <bart.vanassche@gmail.com>
Subject: Re: Any lightweight way for one thread to force another thread to  suspend execution?
Date: Sat, 21 Jun 2008 19:02:28 -0700 (PDT)	[thread overview]
Message-ID: <36111.71.139.37.220.1214100148.squirrel@ruckus.brouhaha.com> (raw)
In-Reply-To: <e2e108260806210938k4ba12874t5f46e524ee188ab3@mail.gmail.com>

Bart wrote:
> Trying to suspend another thread synchronously is a bad idea because
> this can easily trigger deadlocks. E.g. if you suspend a thread while
> that thread holds a lock on a mutex, your application will deadlock.

I understand that and am willing to take responsibility for ensuring
that my application doesn't get into that situation.  Basically I'm
trying to port something that ran on a strict priority preemptive
kernel (on a single processor) to run on a Linux SMP system, so I
need a higher priority thread to completely preempt a lower priority
thread, even though the lower priority thread might be running on
another processor.

As far as I can tell, pthreads doesn't solve this problem, which is
unfortunately, since in other respects pthreads looks like it is
mostly suitable for use in porting code from other real-time kernels
to Linux.

It appears that some pthreads implementations add a nonstandard
pthread_suspend() that can do this.  What I'm looking for is a way
to efficiently implement pthrad_suspend() on Linux, ideally with
a minimum of system calls.

It seems to me that in principle, if the kernel provided a way to do
this, it should be able to suspend a thread that wasn't currently
executing merely by changing some of that thread's metadata, while
suspending a thread that is executing on another processor would be
more expensive since it would be necessary to force an interrupt
on that processor, etc.

Thanks,
Eric


      reply	other threads:[~2008-06-22  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 23:54 Eric Smith
2008-06-21 14:04 ` Andi Kleen
2008-06-22  1:55   ` Eric Smith
2008-06-22  6:33     ` Bart Van Assche
2008-06-22  9:14     ` Jan Engelhardt
2008-06-23 21:08   ` Eric Smith
2008-06-24  7:59     ` Mikael Pettersson
2008-06-21 16:38 ` Bart Van Assche
2008-06-22  2:02   ` Eric Smith [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=36111.71.139.37.220.1214100148.squirrel@ruckus.brouhaha.com \
    --to=eric@brouhaha.com \
    --cc=bart.vanassche@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®