Question to: How long is "long" for a system worker thread?

Hello,

I have started this thread, because the original one
(http://www.osronline.com/showThread.cfm?link=112286)
has been closed because of its age.

Matthew Carter asked:

Is 30 seconds considered “long” in this context
or will it be ok to use a system worker thread?

Doron Holan replied:

IMHO, that is considered to be long, but that’s just me…

I’m in a similar situation as the OP, but with much lower, albeit variable delays.
My driver would need seperate threads in response to user-mode requests.
These threads would delay execution for X ms, whereas X is defined by the requesting program.
Of course, I won’t allow it to set an enormously long delay, so I’m naturally going to limit it to some arbitrary value when doing input validation.
I need this limit to be at least 1 second, but it should be as high as reasonable.

Do you consider a delay of 1 s too long and where would you set the threshold?

Thanks.

Addition:
Of course, I won’t allow the user-mode program to hammer the IOCTL dispatch routine.
As long as the work items are still being queued/processed all further requests will be discarded, so it is somewhat synchronous.

This is really a design issue !

Few questions -

  1. Matt: Why would you have a thread for each request?. From the kernel
    point (IRQL point of view) a thread is sort of least privilaged. If you
    create a whole of threads to process requests there is overhead ( creation,
    activation, deletion of threads ).

2)Alayh: Why would you prevent user code from sending lot of ioctl?. The
design should be otherway around. In fact you might want to overload the
driver with ioctls from many processes with many threads.

  1. In general: What is the limiting factor of long delays? It is an
    application hang. So look at the cancel logic of some example drivers.

I’m sure few people would answer and clear up this in more detail !

-pro

On 7/28/07, xxxxx@hushmail.com wrote:
>
> Hello,
>
> I have started this thread, because the original one
> (http://www.osronline.com/showThread.cfm?link=112286)
> has been closed because of its age.
>
>
> Matthew Carter asked:
> > Is 30 seconds considered “long” in this context
> > or will it be ok to use a system worker thread?
>
> Doron Holan replied:
> > IMHO, that is considered to be long, but that’s just me…
>
> I’m in a similar situation as the OP, but with much lower, albeit variable
> delays.
> My driver would need seperate threads in response to user-mode requests.
> These threads would delay execution for X ms, whereas X is defined by the
> requesting program.
> Of course, I won’t allow it to set an enormously long delay, so I’m
> naturally going to limit it to some arbitrary value when doing input
> validation.
> I need this limit to be at least 1 second, but it should be as high as
> reasonable.
>
> Do you consider a delay of 1 s too long and where would you set the
> threshold?
>
>
> Thanks.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>