multithreading in drivers

hey all,
IS there any possibility to implement multithreading in drivers using dedicated systems threads created by Pscreatesystemthread, if there is then how can we accomplish this.
The reason why i ask is because i need to implement thread scheduling in my custom created driver (which has two system threads, which i want scheduled) as in the process would shift between the two threads. Also i am using a single core processor.

Can you guys explain me how is this accomplished. Any help would be appreciated.

Thanks,
Ironhide

Yes you can create threads in your driver. They will be synchronized
with all the same mechanisms available for any other thread in your
driver. The only things special about those threads is they are kernel
only, i.e are not associated with a user address space, and on unload
your driver needs to terminate them.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@yahoo.com” wrote in message
news:xxxxx@ntdev:

> hey all,
> IS there any possibility to implement multithreading in drivers using dedicated systems threads created by Pscreatesystemthread, if there is then how can we accomplish this.
> The reason why i ask is because i need to implement thread scheduling in my custom created driver (which has two system threads, which i want scheduled) as in the process would shift between the two threads. Also i am using a single core processor.
>
> Can you guys explain me how is this accomplished. Any help would be appreciated.
>
>
> Thanks,
> Ironhide

> The reason why i ask is because i need to implement thread scheduling in my custom created driver

(which has two system threads, which i want scheduled) as in the process would shift between
the two threads. Also i am using a single core processor.

Well, I don’t know what you mean by “scheduling” here, but I really hope you are not trying to implement
a custom scheduler that the OS knows nothing about, in your driver, pretty much the same way Solaris
implements pthreads in the UM. Theoretically you could do it, i.e. create a single system thread and run N custom subthreads that have to scheduled manually , in its context, but I don’t see any reason why you may want to do something like that…

Anton Bassov

xxxxx@yahoo.com wrote:

IS there any possibility to implement multithreading in drivers using dedicated systems threads created by Pscreatesystemthread, if there is then how can we accomplish this.

You really answered your own question there. You use PsCreateSystemThread.

The reason why i ask is because i need to implement thread scheduling in my custom created driver (which has two system threads, which i want scheduled) as in the process would shift between the two threads. Also i am using a single core processor.

Can you guys explain me how is this accomplished. Any help would be appreciated.

The question doesn’t really make much sense. If you create threads in
your driver, the operating system will manage their scheduling, exactly
as it does in an application. A thread is a thread, whether user or
kernel. Your thread will run until you either block or read the end of
a time slice, at which point scheduling will shift to another thread.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

thanks guys for all the help you gave me, as Mr. Don Burn explained, i really wanted to implement a custom scheduling mechanism in my driver, and now i know that it is a possibility to implement it… i would do more research on that, are there are good research papers or any kind of material which i can look into, it would be very helpful.

Why do you think your own thread scheduling is going to help you?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Thursday, March 17, 2011 10:36 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] multithreading in drivers

thanks guys for all the help you gave me, as Mr. Don Burn explained, i really wanted to implement a custom scheduling mechanism in my driver, and now i know that it is a possibility to implement it… i would do more research on that, are there are good research papers or any kind of material which i can look into, it would be very helpful.


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

xxxxx@yahoo.com wrote:

thanks guys for all the help you gave me, as Mr. Don Burn explained, i really wanted to implement a custom scheduling mechanism in my driver,

Allow me to assert that Windows, after more than 20 years of
development, will do a FAR better job of scheduling your threads than
you will. You are wasting your time. I can fully understand using
events and other kernel dispatcher objects to manage a thread pool, but
you really do need to allow the Windows scheduler to do the job it has
been highly optimized to do.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.