Synchronization Primitives

Hi All,

I am developing a kernel mode which requires a synchronization mechanism. I see a lot of synchronization mechanisms provided by WDK. I would like if there is table which provides information about which mechanism to be used under what conditions, IRQL level etc…

Any information would be much helpful.

Thanks,
Madhukar

First of all there are reasons why there are so many, and your question is
so broad no one will know exactly what to reply.
Let us know maybe first what is your issue/paradigm you are trying to solve
and maybe you can get some help like that.

Gabriel

On Fri, Sep 25, 2015 at 12:03 PM, wrote:

> Hi All,
>
> I am developing a kernel mode which requires a synchronization mechanism.
> I see a lot of synchronization mechanisms provided by WDK. I would like if
> there is table which provides information about which mechanism to be used
> under what conditions, IRQL level etc…
>
> Any information would be much helpful.
>
> Thanks,
> Madhukar
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Bercea. G.

Thanks for the reply.

I have the solution for the issue I’m trying to resolve. I was just trying to gather information on various synchronization primitives so it would be useful and have a quick access whenever needed. All the documentation I have gone through provides detailed description. I was just looking for a simple table kind of thing with brief description.

Thanks,
Madhukar

Then you have all the information needed don’t you. You have the solution
for the pbem and the documentation.
You said you have gone through the documentation and saw all the
description you could have taken the time to write what you needed in that
table.
What is the actual thing you need from the forum, I doubt anyone will make
the table for you.

Gabriel.

On Fri, Sep 25, 2015 at 1:59 PM, wrote:

> Thanks for the reply.
>
> I have the solution for the issue I’m trying to resolve. I was just trying
> to gather information on various synchronization primitives so it would be
> useful and have a quick access whenever needed. All the documentation I
> have gone through provides detailed description. I was just looking for a
> simple table kind of thing with brief description.
>
> Thanks,
> Madhukar
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Bercea. G.

Well, actually there a table providing an overview of low IRQL
synchronization primitives in Windows Internals, the Sixth edition, Part 1.

http://postimg.org/image/gr3ry8zmt/

On 25 September 2015 at 16:21, Gabriel Bercea wrote:

> Then you have all the information needed don’t you. You have the solution
> for the pbem and the documentation.
> You said you have gone through the documentation and saw all the
> description you could have taken the time to write what you needed in that
> table.
> What is the actual thing you need from the forum, I doubt anyone will make
> the table for you.
>
> Gabriel.
>
> On Fri, Sep 25, 2015 at 1:59 PM, wrote:
>
>> Thanks for the reply.
>>
>> I have the solution for the issue I’m trying to resolve. I was just
>> trying to gather information on various synchronization primitives so it
>> would be useful and have a quick access whenever needed. All the
>> documentation I have gone through provides detailed description. I was just
>> looking for a simple table kind of thing with brief description.
>>
>> Thanks,
>> Madhukar
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> –
> Bercea. G.
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Mostly only 2 are enough: queued spinlocks (for DISPATCH_LEVEL) and FAST_MUTEX for (<dispatch_level>

Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi All,
>
> I am developing a kernel mode which requires a synchronization mechanism. I see a lot of synchronization mechanisms provided by WDK. I would like if there is table which provides information about which mechanism to be used under what conditions, IRQL level etc…
>
> Any information would be much helpful.
>
> Thanks,
> Madhukar
></dispatch_level>

OP… did you even TRY to Google this before posting here?

Cuz I got a metric SHIT ton of good answers, including:

From The NT Insider:
http://www.osronline.com/article.cfm?id=93

From Microsoft:
https://msdn.microsoft.com/en-us/library/windows/hardware/dn613998(v=vs.85).aspx

Google “synchronization primitivs windows kernel mode” (without the quotes) and you will be the recipient of much wisdom (and some stupid shit, too).

Peter
OSR
@OSRDrivers

> I got a metric SHIT ton of good answers, including:



Well, reading all this stuff requires some effort while the OP needs a “simple table kind of thing with brief description”, which means he just wants someone to do all the work for him. In other words, there is nothing particularly new here - after all, this is not the first time we encounter this approach in this NG, right…

Anton Bassov

Ironically enough, the VERY first link that comes up when googling Peter’s query is EXACTLY that. A simple table of kernel mode primitives. For maximum sarcasm I often like to share a lmgtfy link.

http://lmgtfy.com/?q=synchronization+primitives+windows+kernel+mode&l=1

All kidding aside, is it even POSSIBLE to be a software developer anymore without knowing how to google? I think 90% of dev work these days is copying and modifying sample code from the internet. :wink:

Since the table I put in the book was mentioned as a reference, I’d like to point out the following flaws:

  1. Pushlocks are now exposed for drivers developers – as Flt APIs if you want to take that dependency, and as Driver API in Windows 8 and later. Pushlocks are *awesome*.

  2. Guarded mutexes are faster if targetting < Windows 8, but identical on later operating systems. The cost difference on older operating systems can be amplified if dealing with a PIC vs IOAPIC, and if dealing with virtualization. I think the book covers this, but not the >= Win 8 change.

The table also does not cover Executive Spinlocks, which were added in Vista SP1, and allow read/write semantics on top of the standard spinlock.

Thank you Mr. Ionescu. Good update.

For those interested, there’s quite a nice set of slides by Dave Probert (a very senior MSFT guy, who absolutely knows what he’s talking about) that describes some of the newer lock primitives:

http:

Some of the DDIs shown are out of date (his slides were created before some of these locks were exposed for easy use), but I think the slides will give you a reasonable idea of how some of these things work.

If you haven’t taken the time to look at PushLocks and Rundown Protection, particularly, I highly recommend you do so. Both are “awesome” in Mr. Ionescu’s words.

Peter
OSR
@OSRDrivers</http:>