The operating system maintains pools of worker threads. In some cases it may
create new threads to satisfy new work requests. In general only N threads
will be active in any pool at any time, where N is the number of CPUs in the
system and ‘active’ means executing a worker routine and not in a wait
state.
Handing off work that blocks or takes a long time to a worker thread is
exactly what the NT architecture requires your DISPATCH_LEVEL operations to
do. The ‘takes a long time’ part is negotiable in your design - it is a
trade off you have to make between good overall system performance and good
performance for your specific device subsystem. As blocking using any
mechanism other than a spinlock is illegal at DISPATCH_LEVEL, and as it will
crash the system, if you need to use events, semaphores, resource locks etc.
or call any function that might use any of these, you have no choice, you
must arrange for a PASSIVE_LEVEL thread to perform these activities for you.
Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services
-----Original Message-----
From: Varadan Venkatesh [mailto:xxxxx@tataelxsi.co.in]
Sent: Wednesday, May 09, 2001 7:04 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Things to be done at DISPATCH Level!
Thanks Max for the answer. But I have some more clarifications.
Actually I am registering for a routine which gets invoked at
DISPATCH_LEVEL, when
a particualr routine occurs. (I am writing a WDM driver).
Now I need to do some processing which might take some time and which also
involves waiting for a resource.
Would anybody please suggest me whether it is fine to do the following:
NotificationRoutine () /* This is called at DISPATCH_LEVEL */
{
Invoke IoAllocateWorkItem
Invoke IoQueueWorkItem passing a routine func1 and queueType as
DelayedWorkQueue.
/* This func1 will perform the processing which takes some time and
which
also
* involves waiting for a resource.
*/
}
Now func1 gets called at PASSIVE_LEVEL, so I can do the processing
leisurely. I hope this is ok.
Now when two such notification routines invoke IoQueueWorkItem at the same
time,
will the invocation of func1 be serialised, one after the other OR will
func1 be invoked
in two separate system worker thread contexts?
IOW, is there a single system worker thread which caters to all the work
items queued ? or is a system worker thread spawned for every such call made
to IoQueueWorkItem?
Eagerly Awaiting a reply,
Thanks
Venky
[venky]-----Original Message-----
[venky]From: xxxxx@lists.osr.com
[venky][mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
[venky]S. Shatskih
[venky]Sent: Tuesday, May 08, 2001 12:33 PM
[venky]To: NT Developers Interest List
[venky]Subject: [ntdev] Re: Things to be done at DISPATCH Level!
[venky]
[venky]
[venky]> a priceless resource like ISR processing time? or can i do a major
[venky]workload
[venky]> (like
[venky]> waiting for a resource to be released) at DISPATCH LEVEL.
[venky]This might be a
[venky]
[venky]No, you cannot wait on DISPATCH_LEVEL.
[venky]Register a callback routine (to be called when the event
[venky]occurs) instead.
[venky]
[venky] Max
[venky]
[venky]
[venky]—
[venky]You are currently subscribed to ntdev as: xxxxx@tataelxsi.co.in
[venky]To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
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