Re: Help me for a typical problem regarding KeAquireSpinLock which is not Locking other Thread in Same CPU



Once you have acquired a spin lock you are running at DISPATCH_LEVEL and no
other thread can run on that CPU, so you are somehow lowering IRQL to below
DISPATCH_LEVEL, by either KeLowerIrql (or KeRaiseIrql) or by releasing the
spinlock.


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

"Rohit" <rksindhu@xxxxxxxxx> wrote in message
news:1145960832.896349.226200@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
I have a typical problem regarding KeAquireSpinLock which is not
Blocking other Threads in Same CPU.
The Scenario is I've created 2 threads and in the first thread i call
KeAquireSpinLock to the same global KSPIN_LOCK variable, while its
locked by the first thread which is running the critical section, i
call the same lock in the second thread, and that also gets the lock
and starts running the critical section.
Ideally when first thread has got the lock second should wait, right?
In other words in a Single CPU Scenario a SpinLock should work like a
simple Mutex, right?? Or i'm mistaken, it doen't work at all in case of
Single CPU??
Or is it like, when one thread has got the Lock, means jumped to
Dispatch Level, other Threads will simply remain blocked??
Whatever be the Reason when Thread 1 has got the lock and thread 2 in
same CPU tries to get the same lock is not blocking untill the first
Thread releases it?? Am i doing something worng??
please Help me out, SpinLock is a new topic for me...
thanks and waiting for reply,
Rohit



.



Relevant Pages

  • 2.6.19-rc2 cpu hotplug lockdep warning: possible circular locking dependency
    ... Note that this is plain 2.6.19-rc2 (_without_ the slab cpu ... which lock already depends on the new lock. ... Using ACPI for SMP configuration information ... # ACPI Support ...
    (Linux-Kernel)
  • Re: LTTng finds abnormally long APIC interrupt handler : 58.2 ms
    ... start function tracing on the kernel_softirq_raise marker and the stop ... The first one can enable tracing for the local CPU, ... unique lock identifier as I assume, or is it a pointer to a lock "class" ?) ... The output, rather long, shows the functions called with the spinlock ...
    (Linux-Kernel)
  • Re: Conceptual Problem with Monitor.Enter and Monitor.Exit
    ... You have that output because the first thread can accomplish more than one iteration before Windows steps in and tells it that its current turn with the CPU is up. ... And in particular, the Monitor class maintains a queue of threads waiting on the lock, and the thread that called Waitwon't get the lock until every other thread that was already in the queue before it gets a chance at the lock. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: race on multi-processor solaris
    ... > want to block if the lock holder is not running. ... and there is a CPU structure for each CPU. ... interrupts") are handled by "interrupt threads", ... Before we set the waiters bit, we grab the lock protecting the lock's ...
    (comp.unix.solaris)
  • Re: FreeBSD mail list etiquette
    ... :their Giant kernel lock, and their network lock. ... packet if the protocol thread is on a different cpu. ... These have to do with unexpected blocking deep in a ...
    (freebsd-hackers)

Quantcast