kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: how can we wake up some process which is scheduled?
Date: Tue, 13 Dec 2011 10:17:02 -0800	[thread overview]
Message-ID: <CABi1daGXgUH6YxWcV_953JDOb4FiAvjvZ3VExdXmVaLDLT2vxQ@mail.gmail.com> (raw)
In-Reply-To: <CANudz+tUO861bjL=p=iHatGb1D9PFJfzOCXRBG-Sri_nuE9cOA@mail.gmail.com>

Hi loody,

On Tue, Dec 13, 2011 at 12:44 AM, loody <miloody@gmail.com> wrote:

> hi all:
> There is a kernel API, "schedule_timeout_interruptible".
> since it has the name interruptible, who and how can we interrupt this
> task?
> suppose A use schedule_timeout_interruptible for 20s period and B
> found something and he want to wake up A within this 20s period.
>

You send the task a signal. The API for doing this has a rather unfortunate
name, and is called kill from user-space.

>From kernel space, you can use kill_pid_info, or kill_proc_info.
kill_pid_info is what's called to send SIGALARM when an itimer expires.

Although using signals in kernel space is fairly rare, it's typically a
user-space to kernel-space thing, not a kernel-space to kernel-space thing.

In kernel space, I would generally use something like a timed semaphore
(down_timeout).

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111213/cf0edd32/attachment.html 

      parent reply	other threads:[~2011-12-13 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13  8:44 how can we wake up some process which is scheduled? loody
2011-12-13  8:54 ` Alexandru Juncu
2011-12-13 18:17 ` Dave Hylands [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=CABi1daGXgUH6YxWcV_953JDOb4FiAvjvZ3VExdXmVaLDLT2vxQ@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).