Hello all,

>From the link:
http://www.microsoft.com/whdc/driver/tips/km-basics.mspx#EAAA
under "Getting your driver to handle more than one I/O request at a
time"

Second paragraph:
"Even if your application uses multiple threads, only one
request at a time (per file handle) will get through."

I am doubtful about the "per file handle" part.

I tried the following thing:
>From 2 threads (in an application) i opened the device (created
in a simple driver) using CreateFile (and verified that the
handles are different). One thread called ReadFile in a
loop and the other one called WriteFile in a loop.
But i noticed that driver is handling the request 1
at a time.

So even though the handles are different the calls are serialized.
So what does the "per file handle" mean ?


...Mani

Re: Kernel-Mode Basics by James

James
Mon Feb 14 18:32:56 CST 2005

The point of the URL is, I believe, that one has to specify overlapped I/O.
From what you wrote, I think you've merely duplicated the restriction in
force without overlapped I/O.

--
James Antognini
Windows Driver Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

"Bajamani" <bajamani@hotmail.com> wrote in message
news:1108371113.833605.79920@g14g2000cwa.googlegroups.com...
> Hello all,
>
>>From the link:
> http://www.microsoft.com/whdc/driver/tips/km-basics.mspx#EAAA
> under "Getting your driver to handle more than one I/O request at a
> time"
>
> Second paragraph:
> "Even if your application uses multiple threads, only one
> request at a time (per file handle) will get through."
>
> I am doubtful about the "per file handle" part.
>
> I tried the following thing:
>>From 2 threads (in an application) i opened the device (created
> in a simple driver) using CreateFile (and verified that the
> handles are different). One thread called ReadFile in a
> loop and the other one called WriteFile in a loop.
> But i noticed that driver is handling the request 1
> at a time.
>
> So even though the handles are different the calls are serialized.
> So what does the "per file handle" mean ?
>
>
> ...Mani
>



Re: Kernel-Mode Basics by Bajamani

Bajamani
Mon Feb 14 22:51:40 CST 2005

So the "per file handle" part must "not" be there. Because the calls on

different file handles (on the same device) are also serialized.

Am I correct?

Thanks
Mani


Re: Kernel-Mode Basics by James

James
Tue Feb 15 18:37:53 CST 2005

Without having tried 2 threads, each with a handle open, and using
overlapped, I believe that I/O operations would be overlapped in the same
thread and between threads.

--
James Antognini
Windows Driver Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

"Bajamani" <bajamani@hotmail.com> wrote in message
news:1108443100.079487.223800@c13g2000cwb.googlegroups.com...
> So the "per file handle" part must "not" be there. Because the calls on
>
> different file handles (on the same device) are also serialized.
>
> Am I correct?
>
> Thanks
> Mani
>



Re: Kernel-Mode Basics by Bajamani

Bajamani
Wed Feb 16 04:02:59 CST 2005

Thanks.
Just to clarify, let me put it in a different way.

If I have 2 threads. Each has opened a handle to a device (without
overlapped flag). Will the calls to the device (one thread reads and
other writes) be serialized ?

...Mani


Re: Kernel-Mode Basics by Doron

Doron
Wed Feb 16 11:32:48 CST 2005

they wil be serializedon a handle bases. all reads are serialized against
other reads on the read handle, all writes are serialized against other
writes on the write handle.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Bajamani" <bajamani@hotmail.com> wrote in message
news:1108548179.233045.220070@l41g2000cwc.googlegroups.com...
> Thanks.
> Just to clarify, let me put it in a different way.
>
> If I have 2 threads. Each has opened a handle to a device (without
> overlapped flag). Will the calls to the device (one thread reads and
> other writes) be serialized ?
>
> ...Mani
>



Re: Kernel-Mode Basics by Maxim

Maxim
Wed Feb 16 12:35:04 CST 2005

I think that this is on file object basis and not on handle basis.
DuplicateHandle will not solve serialization, second CreateFile is a must.

My reason to think so is that the mutex used for this serialization is in
FILE_OBJECT structure, as is the CurrentByteOffset field which is the reason
for this serialization to exist.

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

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:OFwyJ2EFFHA.3728@TK2MSFTNGP14.phx.gbl...
> they wil be serializedon a handle bases. all reads are serialized against
> other reads on the read handle, all writes are serialized against other
> writes on the write handle.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Bajamani" <bajamani@hotmail.com> wrote in message
> news:1108548179.233045.220070@l41g2000cwc.googlegroups.com...
> > Thanks.
> > Just to clarify, let me put it in a different way.
> >
> > If I have 2 threads. Each has opened a handle to a device (without
> > overlapped flag). Will the calls to the device (one thread reads and
> > other writes) be serialized ?
> >
> > ...Mani
> >
>
>



Re: Kernel-Mode Basics by Bajamani

Bajamani
Thu Feb 17 06:58:35 CST 2005

Yes. The reads are serialized on read handle.
I observed that Read-Writes are also serialized on a handle.
So i guess any request on a handle will be serialized.

Right?

...Mani