Re: static scheduling - SCHED_IDLE?

Adrian Cox
2001-03-12T19:40:43Z

Jamie Lokier wrote:

> Adrian Cox wrote:

>> Jamie Lokier's suggestion of raising priority when in the kernel doesn't
>> help. You need to raise the priority of the task which is currently in
>> userspace and will call up() next time it enters the kernel. You don't
>> know which task that is.

> Dear oh dear. I was under the impression that kernel semaphores are
> supposed to be used as mutexes only -- there are other mechanisms for
> signalling between processes.

I think most of the kernel semaphores are used as mutexes, with
occasional producer/consumer semaphores. I think the core kernel code is
fine, the risk mostly comes from miscellaneous character devices. I've
written code that does this for a specialised device driver. I wanted
only one process to have the device open at once, and for others to
block on open. Using semaphores meant that multiple shells could do "cat
> /dev/mywidget" and be serialised.

Locking up users of this strange piece of hardware doesn't bring down
the system, so your suggestion could work. We need a big fat warning in
semaphore.h, and a careful examination of the current code.

- Adrian