how to determine functions that have synchronization problem

Dear all:

we know that shared data like global resources and hardware registers
that multiple threads might write them in the same time, so there is
synchronization problem.

But before this, How to know which functions will run in different
threads
access the shared data in a wdm driver ?

Best Regards

You can assume that any function can run in any thread on any CPU :slight_smile: this will lead to safer synchronization :slight_smile:

Also note that for a hardware state which is touched from an ISR, KeSynchronizeExecution is the only option (well, there is also KeAcquireInterruptSpinLock which does the same but is more convinient, but it is “XP and later”)

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

----- Original Message -----
From: Alan Kvng
To: Windows System Software Devs Interest List
Sent: Monday, November 08, 2004 5:11 AM
Subject: [ntdev] how to determine functions that have synchronization problem

Dear all:

we know that shared data like global resources and hardware registers
that multiple threads might write them in the same time, so there is
synchronization problem.

But before this, How to know which functions will run in different threads
access the shared data in a wdm driver ?

Best Regards

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, but what I expect is to program the code not too complex.
Maybe I am wrong for the following reason:
For the same device, I think startio and startio will not run
concurrently,
startio and some dispatch routine will not run concurrently also.

Is it possible to simplify the above synchronization consideration
if we don’t use interrupt ?

Best Regards,


From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Monday, November 08, 2004 4:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] how to determine functions that have
synchronization problem

You can assume that any function can run in any thread on any CPU :slight_smile:
this will lead to safer synchronization :slight_smile:

Also note that for a hardware state which is touched from an ISR,
KeSynchronizeExecution is the only option (well, there is also
KeAcquireInterruptSpinLock which does the same but is more convinient,
but it is “XP and later”)

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

----- Original Message -----
From: Alan Kvng mailto:xxxxx
To: Windows System Software Devs Interest List
mailto:xxxxx
Sent: Monday, November 08, 2004 5:11 AM
Subject: [ntdev] how to determine functions that have
synchronization problem

Dear all:

we know that shared data like global resources and hardware
registers
that multiple threads might write them in the same time, so
there is
synchronization problem.

But before this, How to know which functions will run in
different threads
access the shared data in a wdm driver ?

Best Regards

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to
xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:xxxxx>

There are two scenarios as per your comment –

  1. two instances of startio will not run concurrently
  2. dispatch and startio will not concurrently

How would you ensure the (1) condition, you will have to have a queue, and
someway to figureout if the device is busy serving an IRP, IF YOU DO IT
CORRECTLY THEN of course you could serialize this part…

But the (2) one is too strong, nothing really guarantees that one of the
dispatch can not concurrently executes with your startio ( that is why you
would be queueing IRPs to begin with !!!.

-pro
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Alan Kvng
Sent: Wednesday, November 10, 2004 5:53 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] how to determine functions that have synchronization
problem

Yes, but what I expect is to program the code not too complex.
Maybe I am wrong for the following reason:
For the same device, I think startio and startio will not run
concurrently,
startio and some dispatch routine will not run concurrently also.

Is it possible to simplify the above synchronization consideration
if we don’t use interrupt ?

Best Regards,



From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Monday, November 08, 2004 4:39 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] how to determine functions that have synchronization
problem

You can assume that any function can run in any thread on any CPU :slight_smile:
this will lead to safer synchronization :slight_smile:

Also note that for a hardware state which is touched from an ISR,
KeSynchronizeExecution is the only option (well, there is also
KeAcquireInterruptSpinLock which does the same but is more convinient, but
it is “XP and later”)

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

----- Original Message -----
From: Alan Kvng
To: Windows System Software Devs Interest List
Sent: Monday, November 08, 2004 5:11 AM
Subject: [ntdev] how to determine functions that have synchronization
problem

Dear all:

we know that shared data like global resources and hardware registers
that multiple threads might write them in the same time, so there is
synchronization problem.

But before this, How to know which functions will run in different
threads
access the shared data in a wdm driver ?

Best Regards

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com