efficient locking

Hi,

I’m wondering about the performance of the different types of locking
functions that exists in NT (ie spinlocks and such), if there are any real
difference in speed which one is the fastest?

I also have a question about cli/sti, do they stop/start interrupts on all
cpus on a multiprocessor system or only on the running cpu?

thanks

/hakan

> I’m wondering about the performance of the different types of locking

functions that exists in NT (ie spinlocks and such), if there are any real
difference in speed which one is the fastest?

Spinlock is the fastest - but it a) must not be held for too long b) raises
to DISPATCH_LEVEL.
Among others - fast mutexes are the fastest.

I also have a question about cli/sti, do they stop/start interrupts on all
cpus on a multiprocessor system or only on the running cpu?

Do not use cli/sti. This is too rough a way.
If your data is never accessed from the interrupts - ordinary sync
primitives are OK. If your data is accessed from the interrupts - use
KeSynchronizeExecution.

Max

What about ports ? I need to preserve hardware ports. What type of
synchronization should I use ?

Maybe it sounds a bit silly, but when I wrote driver for my GUS, I came to
use cli/sti and it seems to solve problems I had ( random hangs ).

With respect, Max.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Tuesday, June 27, 2000 8:08 PM
Subject: [ntdev] Re: efficient locking

> > I’m wondering about the performance of the different types of locking
> > functions that exists in NT (ie spinlocks and such), if there are any
real
> > difference in speed which one is the fastest?
>
> Spinlock is the fastest - but it a) must not be held for too long b)
raises
> to DISPATCH_LEVEL.
> Among others - fast mutexes are the fastest.
>
> > I also have a question about cli/sti, do they stop/start interrupts on
all
> > cpus on a multiprocessor system or only on the running cpu?
>
> Do not use cli/sti. This is too rough a way.
> If your data is never accessed from the interrupts - ordinary sync
> primitives are OK. If your data is accessed from the interrupts - use
> KeSynchronizeExecution.
>
> Max
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@csd.tsu.ru
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

Did you test it on an SMP machine

regards
jeseem
mailto:xxxxx@hotmail.com

-----Original Message-----
Subject: Re: efficient locking
From: “Max Sushchenko”
Date: Tue, 27 Jun 2000 20:47:40 +0800
X-Message-Number: 8

What about ports ? I need to preserve hardware ports. What type of
synchronization should I use ?

Maybe it sounds a bit silly, but when I wrote driver for my GUS, I came to
use cli/sti and it seems to solve problems I had ( random hangs ).

With respect, Max.

No I didn’t, I don’t have one. Do you believe it won’t work on SMP ? What
should I do then ?

With respect, Max.

----- Original Message -----
From: “JESEEM”
To: “NT Developers Interest List”
Sent: Thursday, June 29, 2000 4:09 AM
Subject: [ntdev] Re: efficient locking

> Did you test it on an SMP machine
>
> regards
> jeseem
> mailto:xxxxx@hotmail.com
>
> -----Original Message-----
> Subject: Re: efficient locking
> From: “Max Sushchenko”
> Date: Tue, 27 Jun 2000 20:47:40 +0800
> X-Message-Number: 8
>
> What about ports ? I need to preserve hardware ports. What type of
> synchronization should I use ?
>
> Maybe it sounds a bit silly, but when I wrote driver for my GUS, I came to
> use cli/sti and it seems to solve problems I had ( random hangs ).
>
> With respect, Max.
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@csd.tsu.ru
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>