* how can we wake up some process which is scheduled?
@ 2011-12-13 8:44 loody
2011-12-13 8:54 ` Alexandru Juncu
2011-12-13 18:17 ` Dave Hylands
0 siblings, 2 replies; 3+ messages in thread
From: loody @ 2011-12-13 8:44 UTC (permalink / raw)
To: kernelnewbies
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.
--
Regards,
^ permalink raw reply [flat|nested] 3+ messages in thread
* how can we wake up some process which is scheduled?
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
1 sibling, 0 replies; 3+ messages in thread
From: Alexandru Juncu @ 2011-12-13 8:54 UTC (permalink / raw)
To: kernelnewbies
On Tue, Dec 13, 2011 at 10: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.
I think it's related to hardware interrupts, not other tasks. So a
process waiting for a timer can be interrupted by a signal (there's a
switch between process context and interrupt context).
Take a look at schedule_timeout help page [0]. Notice the
TASK_UNINTERRUPTIBLE and TASK_INTERRUPTIBLE sections.
[0] http://kernel.org/doc/htmldocs/device-drivers/API-schedule-timeout.html
--
Alexandru Juncu
ROSEdu
http://rosedu.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* how can we wake up some process which is scheduled?
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
1 sibling, 0 replies; 3+ messages in thread
From: Dave Hylands @ 2011-12-13 18:17 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-13 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).