mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan Donlan <bdonlan@gmail.com>
To: "Nikita V. Youshchenko" <yoush@cs.msu.su>
Cc: linux-kernel@vger.kernel.org, Stas Bezzubtsev <stas@lvk.cs.msu.su>
Subject: Re: Suspend one thread and resume another in one system call ?
Date: Wed, 26 Aug 2009 12:32:51 -0400	[thread overview]
Message-ID: <3e8340490908260932k3872d92am4a55593386c0cff@mail.gmail.com> (raw)
In-Reply-To: <200908262002.06209@zigzag.lvk.cs.msu.su>

On Wed, Aug 26, 2009 at 12:02 PM, Nikita V. Youshchenko<yoush@cs.msu.su> wrote:
> Hello.
>
> Consider a situation when:
> - there is a set of threads,
> - only one of those should be allowed to work at a time,
> - there are "switch moments" when one thread should suspend, and other
> (known) resume.
>
> "Classic" solutions like have each thread sleeping on a semaphore, and
> making switch operation "sem_post(next_sem); sem_wait(my_sem)" cause two
> syscalls per switch.
>
> Could anyone suggest a solution with only one kernel entry per switch -
> running thread enters kernel and is de-scheduled, new thread resumes and
> leaves kernel?
>
> Nikita
>
> P.S.
> Since there are other threads in the same application working in the
> parallel with the mentioned "exclusive set", user-space solutions like
> libpth are not interesting.

If these threads are truly exclusive, just use ucontext.h's
setcontext() to switch threads in userspace.

      reply	other threads:[~2009-08-26 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 16:02 Nikita V. Youshchenko
2009-08-26 16:32 ` Bryan Donlan [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=3e8340490908260932k3872d92am4a55593386c0cff@mail.gmail.com \
    --to=bdonlan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stas@lvk.cs.msu.su \
    --cc=yoush@cs.msu.su \
    /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®