Re: Questions regarding Synchronisation in Windows (Spinlocks)



On Mar 10, 8:02 pm, "Alexander Grigoriev" <al...@xxxxxxxxxxxxx> wrote:
1) spinlocks used to have different implementation in uniprocessor kernel.
Vista/Longhorn now only ship multiprocessor kernel.
Interrupts are handled in context of ISR. There is no thread switch, as they
don't run in a particular thread context.

"smawsk" <sk.sma...@xxxxxxxxx> wrote in message

news:b2a63809-b597-4a8c-a8f4-efc069b3a05b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi,

I have some questions regarding the implementation of synchronisatio
techniques in Windows.
I would be greatful if some one can answer these.

1) How are Spinlocks implemented in Windows for a UNIPROCESSOR
machine? Do they involve busy waiting?
Since Spinlocks execute at DPC/Dispatch level, there is no way for the
thread to move to wait state.

Consider a scenario where a thread is trying to acquire a spin lock.
But an interrupt occurs which has an IRQL > DPC Dispatch level OR the
IRQL of the thread that acquired the spin lock. For the new interrupt
to be serviced, dispatcher has to be invoked to switch to the new
thread servicing the interrupt.

What happens in this scenario?

2) What is the difference between an executive object and a kernel
object? Can some one give an example for each?
I reckon Semaphore, Event, Mutex etc are executive objects. So what
kernel objects are these executive objects built on?

Which category do "Dispatcher" objects belong to?

3) What is th edifference between a Mutex and Fast Mutex/Guarded
Mutex?

Thanks in advance.

Warm Regards.

Hi,

Thanks for you reply.
But when hardware generates an interrupt, whatever code that was being
executed should be stopped. The executing context should be saved
before the control is handed over to the ISR.

How different is this from a thread switch where in the context of the
currently running thread is saved and code is executed in the context
of a different thread?

I am trying to get my basics right.

Regarding other questions, I did some more research and found this.
Could you please let me know if my understanding is correct?

The difference between a Normal Mutex and a fast mutex is that, a fast
mutex does not maintain thread ownership as a normal mutex does.

For each executive object (dispatcher) there is a corresponding kernel
object on which its built.
For instance, Semaphore uses a data structure implemented by the
kernel called KSEMAPHORE.

Thanks in advance.

Warm Regards.
.



Relevant Pages

  • Re: linux context switching
    ... the process is excuted in a kernel mode, at this momnet is there context ... all registers are saved on the stack. ... interrupt handler is excuted ...
    (comp.os.linux.development.system)
  • Re: Why cant we sleep in an ISR?
    ... interrupt is not associated with any context in the first place. ... includes the kernel and userspace stack pointers, the register set, ... this, an interrupt, depending on the version of your kernel and arch, ...
    (Linux-Kernel)
  • Re: linker_load_module(NULL, "modname", ...) from thread with no user process
    ... J>>>thread with no associated user process, and it asks to load module by ... J>>thread or software interrupt is a really bad idea. ... J>>context. ... J>>kernel without an upcall. ...
    (freebsd-hackers)
  • linux context switching
    ... In linux, is there kernel context? ... a user process is having CPU ... H/W interrupt occurs ...
    (comp.os.linux.development.system)
  • Re: LinuxPPS & spinlocks
    ... I meant that if you have to lock between user context and interrupt ... Ok, I see, but how you can get your PPS source data struct starting ...
    (Linux-Kernel)