MAXIMUM_WAIT_OBJECTS_EXCEEDED

My driver causes MAXIMUM_WAIT_OBJECTS_EXCEEDED BSOD. What does it mean?

Alexey Logachyov
xxxxx@vba.com.by
VirusBlokAda ltd.
http://www.vba.com.by


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

Too many objects passed to KeWaitForMultipleObjects. The number is limited.

Max

----- Original Message -----
From: “Alexey Logachyov”
To: “NT Developers Interest List”
Sent: Tuesday, January 08, 2002 3:02 PM
Subject: [ntdev] MAXIMUM_WAIT_OBJECTS_EXCEEDED

> My driver causes MAXIMUM_WAIT_OBJECTS_EXCEEDED BSOD. What does it mean?
>
> Alexey Logachyov
> xxxxx@vba.com.by
> VirusBlokAda ltd.
> http://www.vba.com.by
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.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

Is 4 objects too much? I’m actually gonna need waiting on 5 objects. Is it
possible?

Ah! I actually did not read the DDK help carefuly enough. I must want to use
WaitBlockArray to wait on more than THREAD_WAIT_OBJECTS objects (which is
3). Can anyone explain how to do it?

Alexey Logachyov
xxxxx@vba.com.by
VirusBlokAda Ltd.
http://www.vba.com.by

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Tuesday, January 08, 2002 3:58 PM
Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED

> Too many objects passed to KeWaitForMultipleObjects. The number is
limited.
>
> Max
>
> ----- Original Message -----
> From: “Alexey Logachyov”
> To: “NT Developers Interest List”
> Sent: Tuesday, January 08, 2002 3:02 PM
> Subject: [ntdev] MAXIMUM_WAIT_OBJECTS_EXCEEDED
>
>
> > My driver causes MAXIMUM_WAIT_OBJECTS_EXCEEDED BSOD. What does it mean?
> >
> > Alexey Logachyov
> > xxxxx@vba.com.by
> > VirusBlokAda ltd.
> > http://www.vba.com.by
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@vba.com.by
> 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

Allocate an array of structures and specify it to KeWaitForMultipleObjects.
Or you can implement your own KeWaitForMultipleObjects with unlimited sets - I recently did this for kernel-mode socket library (for
poll() and select()).

Max

----- Original Message -----
From: “Alexey Logachyov”
To: “NT Developers Interest List”
Sent: Wednesday, January 09, 2002 1:04 AM
Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED

> Is 4 objects too much? I’m actually gonna need waiting on 5 objects. Is it
> possible?
>
> Ah! I actually did not read the DDK help carefuly enough. I must want to use
> WaitBlockArray to wait on more than THREAD_WAIT_OBJECTS objects (which is
> 3). Can anyone explain how to do it?
>
> Alexey Logachyov
> xxxxx@vba.com.by
> VirusBlokAda Ltd.
> http://www.vba.com.by
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Tuesday, January 08, 2002 3:58 PM
> Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED
>
>
> > Too many objects passed to KeWaitForMultipleObjects. The number is
> limited.
> >
> > Max
> >
> > ----- Original Message -----
> > From: “Alexey Logachyov”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, January 08, 2002 3:02 PM
> > Subject: [ntdev] MAXIMUM_WAIT_OBJECTS_EXCEEDED
> >
> >
> > > My driver causes MAXIMUM_WAIT_OBJECTS_EXCEEDED BSOD. What does it mean?
> > >
> > > Alexey Logachyov
> > > xxxxx@vba.com.by
> > > VirusBlokAda ltd.
> > > http://www.vba.com.by
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@vba.com.by
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.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

If I recall correctly, you just provide the storage as an array of
KWAIT_BLOCKs of the appropriate size. You probably should make sure that it
is nonpagedpool and not on the stack. KeWFMO is going to use your storage
rather than have to bother with allocating his own.

-----Original Message-----
From: Alexey Logachyov [mailto:xxxxx@vba.com.by]
Sent: Tuesday, January 08, 2002 5:05 PM
To: NT Developers Interest List
Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED

Is 4 objects too much? I’m actually gonna need waiting on 5
objects. Is it possible?

Ah! I actually did not read the DDK help carefuly enough. I
must want to use WaitBlockArray to wait on more than
THREAD_WAIT_OBJECTS objects (which is 3). Can anyone explain
how to do it?

Alexey Logachyov
xxxxx@vba.com.by
VirusBlokAda Ltd.
http://www.vba.com.by

----- Original Message -----
From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Tuesday, January 08, 2002 3:58 PM
> Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED
>
>
> > Too many objects passed to KeWaitForMultipleObjects. The number is
> limited.
> >
> > Max
> >
> > ----- Original Message -----
> > From: “Alexey Logachyov”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, January 08, 2002 3:02 PM
> > Subject: [ntdev] MAXIMUM_WAIT_OBJECTS_EXCEEDED
> >
> >
> > > My driver causes MAXIMUM_WAIT_OBJECTS_EXCEEDED BSOD. What does it
> > > mean?
> > >
> > > Alexey Logachyov
> > > xxxxx@vba.com.by
> > > VirusBlokAda ltd.
> > > http://www.vba.com.by
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> > > unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@vba.com.by
> > 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

Isn’t this a VERY bad idea? Firstly, the internals of the kernel are not
documented, so your own implementation may break in the future, and
secondly, there is a very good reason for the 64 object limit: it takes
time to set up a lot of WAIT_BLOCKs, and while doing this, the dispatcher
lock must be held, which prevents scheduling ( on all cpus? ) for a
time. It also takes time while holding the lock to wake up the thread and
tear down all of the WAIT_BLOCKs. On SMP systems, this will cause the
other cpus to busy wait while they are waiting for the dispatcher lock, and
on all systems, it will delay thread switching and preemption.

Is my take on this correct?

At 12:26 PM 1/10/2002 +0300, you wrote:

Allocate an array of structures and specify it to KeWaitForMultipleObjects.
Or you can implement your own KeWaitForMultipleObjects with unlimited sets

  • I recently did this for kernel-mode socket library (for
    poll() and select()).

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

----- Original Message -----
From: “Phillip Susi”
To: “NT Developers Interest List”
Sent: Saturday, January 19, 2002 1:33 PM
Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED

> Isn’t this a VERY bad idea? Firstly, the internals of the kernel are not
> documented, so your own implementation may break in the future, and
> secondly, there is a very good reason for the 64 object limit: it takes
> time to set up a lot of WAIT_BLOCKs, and while doing this, the dispatcher
> lock must be held, which prevents scheduling ( on all cpus? ) for a
> time. It also takes time while holding the lock to wake up the thread and
> tear down all of the WAIT_BLOCKs. On SMP systems, this will cause the
> other cpus to busy wait while they are waiting for the dispatcher lock, and
> on all systems, it will delay thread switching and preemption.
>
> Is my take on this correct?
I agree with your points, but not with your “take”. Hard coding in arbitary limits is
usually a bad idea. Deciding to do this to prevent someone from maybe getting
bad performance under certain conditions on SMPs is a bad idea. Esp. when
that bad performance is due to a particular implementation.

There are many cases where you occasionally may need to wait on say 66 or 74 or 128 items,
but performance isn’t critical. For example, I have some wierd device that is
watching a process, and signaling alarms, and the software models each alarm as an
event. The rate that events are signaled is say once per hour. I’ve got the whole thing
working the 48 alarms. Should I have to rewrite the application, etc., because someone
thought it was a good idea to put in an arbitrary limit of 64? What if I don’t have an SMP?

On the flip side, I’ve seen cases where poll & select with two objects is a performance
issue, 16 is a serious problem, and 64 is horrible, since the “WaitForMultipleObjects”
is order n-squared.

An implementation that is typically order n that I used once was to have the kernel create a “wait group” object.
Each “wait event” would start out in its own “wait group”.
On a “wait for multiple objects”, the kernel would merge all “wait objects” into one
“wait group”, where they would remain until deleted. Then the thread would wait on the
single “wait group” object, and subsequent wait calls would only need to validate
that the objects specified were all in the same group. In terms of locks, the performance
of such an algorithm is order n. So the bad performance argument is due to implementation,
and is not so much an intrinsic function of the interface.
[The cases where the above algorithm doesn’t work well for is where different
threads are waiting on non-identical, intersecting subsets of objects (I’ve never seen
a real application that does this).]
-DH

>
> At 12:26 PM 1/10/2002 +0300, you wrote:
> >Allocate an array of structures and specify it to KeWaitForMultipleObjects.
> >Or you can implement your own KeWaitForMultipleObjects with unlimited sets
> >- I recently did this for kernel-mode socket library (for
> >poll() and select()).
> >
> > Max
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@syssoftsol.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

Unlimitied WaitForMultipleObjects can be done using 1 and only kernel event, though you will possibly need to write your own
structures instead of KEVENT to wait on.
No need in holding the dispatcher lock while initializing the array.

Max

----- Original Message -----
From: “Phillip Susi”
To: “NT Developers Interest List”
Sent: Saturday, January 19, 2002 9:33 PM
Subject: [ntdev] Re: MAXIMUM_WAIT_OBJECTS_EXCEEDED

> Isn’t this a VERY bad idea? Firstly, the internals of the kernel are not
> documented, so your own implementation may break in the future, and
> secondly, there is a very good reason for the 64 object limit: it takes
> time to set up a lot of WAIT_BLOCKs, and while doing this, the dispatcher
> lock must be held, which prevents scheduling ( on all cpus? ) for a
> time. It also takes time while holding the lock to wake up the thread and
> tear down all of the WAIT_BLOCKs. On SMP systems, this will cause the
> other cpus to busy wait while they are waiting for the dispatcher lock, and
> on all systems, it will delay thread switching and preemption.
>
> Is my take on this correct?
>
> At 12:26 PM 1/10/2002 +0300, you wrote:
> >Allocate an array of structures and specify it to KeWaitForMultipleObjects.
> >Or you can implement your own KeWaitForMultipleObjects with unlimited sets
> >- I recently did this for kernel-mode socket library (for
> >poll() and select()).
> >
> > Max
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.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