How many queues has one thread got in NT?

Hi

1-) “The system automatically creates a message queue for each thread”
http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx

2-)“Each thread has its own APC queues”
Windows Internals

Are these different kinds of queues? If so; how many queues are created for one thread by windows?

Thanks

Yes, they are different queues. There is also a list of i/o requests issued on the thread as well as other internal book keeping lists.

Why ? just curious?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, July 22, 2008 6:17 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How many queues has one thread got in NT?

Hi

1-) “The system automatically creates a message queue for each thread”
http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx

2-)“Each thread has its own APC queues”
Windows Internals

Are these different kinds of queues? If so; how many queues are created for one thread by windows?

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

I was reading an article about MFCs’ worker and user interface thread issue. I remembered APC queue chapter in kernel mode books. And i confused and asked.

Are these queues documented? I mean is there a reference documentation about what kinds of queues one thread has got and how one thread determine which queue it will process.

Have queues got priority levels?

> I was reading an article about MFCs’ worker and user interface thread issue.

I remembered APC queue chapter in kernel mode books. And i confused and asked.

As the very term “asynchronous” strongly suggests, APC queues have nothing to do with win32 windows message queues whatsoever. APC gets sent to a thread in order to inform it about “unplanned” events like IO completion or exception, and it gets processed on the spot, unless APC delivery is temporarily disabled (for example, thread has entered non-alertable wait) - you don’t retrieve APC message from a queue the way you retrieve user messages . You can think of APC just as of some form of interrupt - the only difference is that interrupt gets raised on the CPU regardless of the thread it currently runs, while APC gets delivered to a specific thread. If you a re familiar with UNIX, APC is a Windows equivalent of a signal…

Are these queues documented?

It does not seem to be the case…

Have queues got priority levels?

Please note that there are user APCs, “normal” kernel APCs and special ones. The ones of the former type cannot be processed until the target thread returns to the user mode, while kernel-level ones can be delivered while the target thread is still in the kernel mode. Please check KeWaitXXX… documentation, so that you will see under what circumstances waiting thread can be alerted by APC of a given type…

Anton Bassov

xxxxx@gmail.com wrote:

Are these queues documented? I mean is there a reference documentation about what kinds of queues one thread has got and how one thread determine which queue it will process.

A thread does not determine this. Except for the message queue, these
other queues are simply internal details of the Windows implementation,
and are not accessible by the thread.


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

Thanks for all answers.

> 1-) “The system automatically creates a message queue for each thread”

http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx

2-)“Each thread has its own APC queues”
Windows Internals

Are these different kinds of queues?

Yes. Message queue is in win32k, and APC queue is in the kernel itself.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com