TDI file objects and driver threads

Hi all,
I’m working on a TDI client driver that will handle multiple instances of its
associated device. I plan to use a thread created with PsCreateSystemThread()
to deal with the TDI file objects in the context of the system process. Two
issues:

  1. Are driver-created threads “expensive”? In other words, can I call
    PsCreateSystemThread() an arbitrary number of times , or are such threads a
    scarce resource? The simple design I have in mind would create a thread per
    instance of the device at open time. The thread would create the file objects
    and block on a “kill” event. At device close time, I’d set the “kill” event,
    and the thread would close the file objects and self-terminate.

  2. I have a second idea that would avoid potentially consuming many system
    threads in the event that they are scarce resources. I would call
    PsCreateSystemThread() twice, once in the device open path for a thread that
    creates the TDI file objects and self-terminates, and again in the device close
    path for a thread that closes the file objects and self-terminates. From my
    reading of the docs, both threads would run in the (same) system process, so it
    seems like this should work.

Any thoughts?

Sincerely,

Chris Myers
Senior Project Engineer
Quatech, Inc.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

“Chris Myers” wrote in message news:xxxxx@ntdev…
>
> 1. Are driver-created threads “expensive”? In other words, can I call
> PsCreateSystemThread() an arbitrary number of times , or are such threads
a
> scarce resource?
>

Nope, driver-created worker threads are not a scarce resource. You can’t
“run out of 'em” or anything. On the other hand, creating (literally)
hundreds of these wouldn’t be a good idea, either.

Peter
OSR


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> associated device. I plan to use a thread created with PsCreateSystemThread()

to deal with the TDI file objects in the context of the system process. Two

Forget about TdiBuildInternalDeviceControlIrp (which calls PASSIVE_LEVEL-only function IoBuildDeviceIoControlRequest) and use
IoAllocateIrp with proper filling instead.
This will allow you to send and receive TCP/IP/UDP data from DISPATCH_LEVEL. This is tested in our socket library.

I do not know why MS invented this stupid macro if TCPIP.SYS can work on DISPATCH_LEVEL, in our times of iSCSI it just hinders.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

** Reply to message from “PeterGV” on Tue, 19 Feb 2002
17:14:03 -0500

Peter,

> Nope, driver-created worker threads are not a scarce resource. You can’t
> “run out of 'em” or anything. On the other hand, creating (literally)
> hundreds of these wouldn’t be a good idea, either.

Thanks for the confirmation on this. That’s pretty much what I thought, but I
had seen some conflicting information in the newsgroups. I promise not to
create more than one thread per instance. Now, if the user decides to install
hundreds of instances, well, he hopefully has a fusion-powered system anyway
:-)!

Sorry for the late reply. We lost our internet connection nearly all day
yesterday.

Sincerely,

Chris Myers
Senior Project Engineer
Quatech, Inc.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

** Reply to message from “Maxim S. Shatskih” on Wed,
20 Feb 2002 06:50:00 +0300

Max,

> Forget about TdiBuildInternalDeviceControlIrp (which calls PASSIVE_LEVEL-only
> function IoBuildDeviceIoControlRequest) and use IoAllocateIrp with proper filling instead.
> This will allow you to send and receive TCP/IP/UDP data from DISPATCH_LEVEL.
> This is tested in our socket library.

My immediate question was about the ZwCreateFile/ZwClose business with the TDI
address and connection file objects, which must be done at PASSIVE_LEVEL.
However, you’ve provided me with some information that will come in handy in
another spot, so thanks!

Sincerely,

Chris Myers
Senior Project Engineer
Quatech, Inc.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> My immediate question was about the ZwCreateFile/ZwClose business with the TDI

address and connection file objects, which must be done at PASSIVE_LEVEL.

I know of no ways of doing this at > PASSIVE_LEVEL.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com