Re: How to sleep a kernel thread?

From: Matthew Dharm (mdharm-kernel@one-eyed-alien.net)
Date: Sat Jun 03 2000 - 04:31:00 EST


Will a wait queue work in the situation where we do a "wake up" before the
thread is actually "sleeping"?

And what happens if we do wake-ups faster than we sleep -- do wake-ups have
an incrementing counter of some sort, or will we lose the multiple wake-ups?

And what if we don't want to be interrupted? Does that still count as
running?

Matt Dharm

On Sat, Jun 03, 2000 at 09:22:14AM +0100, Russell King wrote:
> Matthew Dharm writes:
> > Spinlocks can give me mutual exclusion, but what I need to do is sleep
> > until there is something in the queue to process. This is a textbook
> > application of semaphores -- or is the kernel implementation of semaphores
> > not so textbook?
>
> Use wait queues. They have both non-interruptible and interruptible
> versions. The interruptible version uses TASK_INTERRUPTIBLE, which
> won't be counted as a running process.
> _____
> |_____| ------------------------------------------------- ---+---+-
> | | Russell King rmk@arm.linux.org.uk --- ---
> | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
> | +-+-+ --- -+-
> / | THE developer of ARM Linux |+| /|\
> / | | | --- |
> +-+-+ ------------------------------------------------- /\\\ |

-- 
Matthew Dharm                              Home: mdharm@one-eyed-alien.net 
Senior Engineer, QCP Inc.                            Work: mdharm@qcpi.com

What the hell are you? -- Pitr to Dust Puppy User Friendly, 12/3/1997

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:16 EST