Re: Spinlocks under uniprocessor running non preemptible kernel



MAx <mahesh1280@xxxxxxxxx> wrote in news:1190370654.803795.230210
@e9g2000prf.googlegroups.com:

Does that mean spinlocks do not do the job they are meant to do on a
uniprocessor system with
linux 2.4.x(non-preemptible kernel)

The job they are "meant to do" only applies to multiprocessor systems.
Spinlocks simply don't make sense on a uniprocessor system. It's perfectly
okay to run a multiprocessor kernel on a uniprocessor system, but the
spinlocks it uses just waste CPU cycles. Sure, a spinlock in that kernel
could hang a uniprocessor machine if incorrectly implemented, but in almost
every such case, it would also hang a multiprocessor machine.

There are a few cases where a spinlock would hang a non-preemptible
uniprocessor kernel where it would not necessarily hang a multiprocessor
kernel or a preemptible uniprocessor kernel; however, I cannot think of a
case where this is anything other than a very bad design (i.e. an
inappropriate use of a spinlock).

GH
.



Relevant Pages

  • Re: Spinlocks under uniprocessor running non preemptible kernel
    ... linux 2.4.x(non-preemptible kernel) ... either a spinlock() call will succeed immediately or hang infinitely. ...
    (comp.os.linux.development.system)
  • Re: SpinLock/Mutex : Difference ?
    ... you have to go to kernel anyway. ... I never once said that user mode code should in any way ... spinlock owner is guaranteed to never get preempted by another thread. ... thread/process may have to "spin" for a time, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: SpinLock/Mutex : Difference ?
    ... you have to go to kernel anyway. ... I never once said that user mode code should in any way ... spinlock owner is guaranteed to never get preempted by another thread. ... the kernel level synchronization objects from the app level, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: SpinLock/Mutex : Difference ?
    ... You seem to think that a spinlock is is something that only the kernel can ... But anyone can write an equivalent API for user mode, all you need to do is ...
    (microsoft.public.win32.programmer.kernel)
  • Re: SpinLock/Mutex : Difference ?
    ... A spinlock is NOT a "kernel mode mechanism" period. ... Is it not better to simply better to define a tny struct typedef "SpinLock" ...
    (microsoft.public.win32.programmer.kernel)