Re: why spinlock raises IRQL to DISPATCH



Because a spinlock has other threads spin on the lock. If you do not
disable scheduling you can create a situation where most of your systems CPU
time is spent spinning on locks, and where a low priority thread has
acquired the lock then is starved by spinning to the point that it taks a
long time to release it.

Spin locks are spupposed to be low overhead locks for short periods of use.
Note: on a uniprocessor implementation the lock is never set, the
implementation is just raise to dispatch to disable scheduling.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"Bajamani" <bajamani@xxxxxxxxxxx> wrote in message
news:1116246989.835297.82030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Why does spinlock implementation raise the irql to dispatch level? just
> acquiring the lock at passive level should prevent other threads from
> accessing the same lock.
>


.



Relevant Pages

  • [patch] generic rwsems
    ... This patch converts all architectures to a generic rwsem implementation, ... take a spinlock to take an uncontested rwsem) as a basis. ... better even for architectures that do atomics with hashed spinlocks. ... * lock for reading ...
    (Linux-Kernel)
  • [ANNOUNCE] The -rt git tree
    ... People have also been asking about having an -rt git tree. ... rt/convert-scripts - the scripts to convert spinlocks ... The new lock API. ... where as a spinlock that was declared as raw_spinlock_t would ...
    (Linux-Kernel)
  • Re: Locking Primitives
    ... No attempt is made to "repair" any shared memory or do any recovery. ... The motivation was to distinguish between failing to get a lock because it ... The shared spinlock data structure contains the PID and TID of the locker, ... void rdunlock() { ...
    (microsoft.public.win32.programmer.kernel)
  • Re: [ANNOUNCE] The -rt git tree
    ... Mostly new mainline work. ... People have also been asking about having an -rt git tree. ... The new lock API. ... where as a spinlock that was declared as raw_spinlock_t would ...
    (Linux-Kernel)
  • Re: LinuxPPS & spinlocks
    ... syscalls introduced in the API exported to userspace, ... register/unregister functions are using /both/ the mutex and spinlock ... Note that *data* is protected by a lock, ... I think you're unnecessarily worrying about contention here -- you can ...
    (Linux-Kernel)