Hi,

Do mutexes protect against concurrent access from another CPU? I have
a worker thread which acquires a mutex before a critical section and
then releases it. If, on an SMP machine, another instance of this
thread executes, would it also be serialized by the same mutex?

Also, generally speaking, when is it better to use spinlocks? My
driver uses mutexes only.

Regards,

James

Re: Neophyte question on SMP & mutexes by Mark

Mark
Thu Jun 30 20:50:42 CDT 2005

liquidl@email.com wrote:
> Hi,
>
> Do mutexes protect against concurrent access from another CPU? I have
> a worker thread which acquires a mutex before a critical section and
> then releases it. If, on an SMP machine, another instance of this
> thread executes, would it also be serialized by the same mutex?
>
> Also, generally speaking, when is it better to use spinlocks? My
> driver uses mutexes only.
>
> Regards,
>
> James
>
Yes mutexes are SMP safe. Use spinlocks if you are protecting shared
data that is accessed by your interrupt/dpc/completion side of your driver.

--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

Re: Neophyte question on SMP & mutexes by Maxim

Maxim
Fri Jul 01 16:24:25 CDT 2005

"Another instance of this thread" is nonsense. Mutex allows only 1 thread
to enter, and this guarantee is also valid on SMP, regardless of on what CPU
threads run.
Spinlocks are only used (usually) to guard the access from the several
contexts, some of them are DISPATCH_LEVEL.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

<liquidl@email.com> wrote in message
news:1120178582.962868.198570@g49g2000cwa.googlegroups.com...
> Hi,
>
> Do mutexes protect against concurrent access from another CPU? I have
> a worker thread which acquires a mutex before a critical section and
> then releases it. If, on an SMP machine, another instance of this
> thread executes, would it also be serialized by the same mutex?
>
> Also, generally speaking, when is it better to use spinlocks? My
> driver uses mutexes only.
>
> Regards,
>
> James
>



Re: Neophyte question on SMP & mutexes by Bajamani

Bajamani
Tue Jul 05 03:46:43 CDT 2005

so if we want to synchronize between the threads at PASSIVE level what
should be used. which is faster.


Re: Neophyte question on SMP & mutexes by Maxim

Maxim
Tue Jul 05 06:37:12 CDT 2005

FAST_MUTEX

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Bajamani" <bajamani@hotmail.com> wrote in message
news:1120553203.776909.46670@g43g2000cwa.googlegroups.com...
> so if we want to synchronize between the threads at PASSIVE level what
> should be used. which is faster.
>