linux sleep implementation
- From: "Ask" <ask.q@xxxxxxxxxxxxxx>
- Date: 15 Sep 2006 08:46:28 -0700
1> sleeping in the kernel is like this (source taken from Robert Love
Book, page 53)
add_wait_queue(q, &wait);
while (!condition) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current))
...............................
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(q, &wait);
Isn't it possible that just before the schedule is invoked, the task is
pre-empted. What if it is preempted because of the event that it
intends to wait for occurs. Will it give weird result in that case ?
2> What happens after the task in TASK_INTERRUPTIBLE state receives a
signal and finshes with the associated handler. Does it go back to
sleep again ?
Thanks
.
- Follow-Ups:
- Re: linux sleep implementation
- From: Kaz Kylheku
- Re: linux sleep implementation
- From: Iwo Mergler
- Re: linux sleep implementation
- Prev by Date: Re: Get pid of a process
- Next by Date: Re: linux sleep implementation
- Previous by thread: Get pid of a process
- Next by thread: Re: linux sleep implementation
- Index(es):
Relevant Pages
|