Discussion:
maximum number of window message queue
(too old to reply)
lauch2
2006-02-16 07:29:31 UTC
Permalink
Does anyone know the maximum number of window message queue (i.e
CWnd::PostMessage) for Window XP

thanks in advance

lauch
David Lowndes
2006-02-15 08:01:22 UTC
Permalink
Post by lauch2
Does anyone know the maximum number of window message queue (i.e
CWnd::PostMessage) for Window XP
Unlike 16-bit Windows where an application had a limited message queue
size (that the application could alter), Win32 has dynamic message
queue sizes, so they're limited by availability of memory or some
(relatively large) fixed size.

Why do you want to know?

Dave
lauch2
2006-02-16 08:38:27 UTC
Permalink
Thanks David,

My application has 2 threads, one is UI thread(the main thread); another is
a thread that would post message to the UI thread to update screen. However,
I found that the UI thread would stop running occassionally and resume to
normal after some time. When the UI thread stopped running, another thread
had posted some 70,000 messages to the UI thread, it looks like only the
first, say, 50,000 messages would be processed by the UI thread when it
resume to normal.

Anyway, I just want to collect more information about the window message
queue.
An other idea?

lauch
Post by David Lowndes
Post by lauch2
Does anyone know the maximum number of window message queue (i.e
CWnd::PostMessage) for Window XP
Unlike 16-bit Windows where an application had a limited message queue
size (that the application could alter), Win32 has dynamic message
queue sizes, so they're limited by availability of memory or some
(relatively large) fixed size.
Why do you want to know?
Dave
David Lowndes
2006-02-15 14:45:38 UTC
Permalink
Post by lauch2
My application has 2 threads, one is UI thread(the main thread); another is
a thread that would post message to the UI thread to update screen. However,
I found that the UI thread would stop running occassionally and resume to
normal after some time.
So what was causing it to stop processing its messages? Is it busy
doing a long task, or is your other thread starving it by running at a
higher priority?
Post by lauch2
When the UI thread stopped running, another thread
had posted some 70,000 messages to the UI thread, it looks like only the
first, say, 50,000 messages would be processed by the UI thread when it
resume to normal.
Those are big numbers (compared to the old 16-bit limits) :)
How do you know 70,000 messages were posted and only 50,000 were
processed? Did all the PostMessage calls succeed?
Post by lauch2
Anyway, I just want to collect more information about the window message
queue.
An other idea?
To do what?

I assume you've already found the Platform SDK documentation on MSDN,
such as the topic titled "Using Messages and Message Queues".

Dave
lauch2
2006-02-16 15:46:44 UTC
Permalink
Thanks Dave
Post by David Lowndes
So what was causing it to stop processing its messages? Is it busy
doing a long task, or is your other thread starving it by running at a
higher priority?
Still working on this issue. It seems not the cases you suspected. In fact,
this problem has happened for 4 years(from NT to WindowsXP). We had offically
asked Microsoft's prieme support, but they required us to set up some
monitoring tools on the problem PCs. However, all problem PCs were on
production and no extra programs were allowed to run. The only thing we could
do is to collect the program trace. Base on the program trace, we found the
UI thread occassionally stopped running while the other thread kept posting.
The period of the suspension of UI thread varied from several seconds to 2
days. the case of the 70,000 messages was lasted for 2 days.
Post by David Lowndes
Those are big numbers (compared to the old 16-bit limits) :)
How do you know 70,000 messages were posted and only 50,000 were
processed? Did all the PostMessage calls succeed?
Based on the trace, I found there had 70,000 messages been posted to the UI
thread and there had 50,000 messages been processed by the UI thread. Since
the program did not check the result of PostMessage, I dont know the problem
was due to PostMessage failure or the exceeding of message queue.
Post by David Lowndes
I assume you've already found the Platform SDK documentation on MSDN,
such as the topic titled "Using Messages and Message Queues".
I have not search the MSDN yet. I think it should be a registry setting,
which can be configurable.

Regards
lauch
Post by David Lowndes
Post by lauch2
My application has 2 threads, one is UI thread(the main thread); another is
a thread that would post message to the UI thread to update screen. However,
I found that the UI thread would stop running occassionally and resume to
normal after some time.
So what was causing it to stop processing its messages? Is it busy
doing a long task, or is your other thread starving it by running at a
higher priority?
Post by lauch2
When the UI thread stopped running, another thread
had posted some 70,000 messages to the UI thread, it looks like only the
first, say, 50,000 messages would be processed by the UI thread when it
resume to normal.
Those are big numbers (compared to the old 16-bit limits) :)
How do you know 70,000 messages were posted and only 50,000 were
processed? Did all the PostMessage calls succeed?
Post by lauch2
Anyway, I just want to collect more information about the window message
queue.
An other idea?
To do what?
I assume you've already found the Platform SDK documentation on MSDN,
such as the topic titled "Using Messages and Message Queues".
Dave
lauch2
2006-02-16 15:52:29 UTC
Permalink
hi, Dave
Post by David Lowndes
I assume you've already found the Platform SDK documentation on MSDN,
such as the topic titled "Using Messages and Message Queues".
Just search the MSDN, the following was found (from PostMessage() API):

Windows 2000/XP: There is a limit of 10,000 posted messages per message
queue. This limit should be sufficiently large. If your application exceeds
the limit, it should be redesigned to avoid consuming so many system
resources. To adjust this limit, modify the following registry key.
HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows NT
CurrentVersion
Windows
USERPostMessageLimit


Regards,
lauch
Post by David Lowndes
Post by lauch2
My application has 2 threads, one is UI thread(the main thread); another is
a thread that would post message to the UI thread to update screen. However,
I found that the UI thread would stop running occassionally and resume to
normal after some time.
So what was causing it to stop processing its messages? Is it busy
doing a long task, or is your other thread starving it by running at a
higher priority?
Post by lauch2
When the UI thread stopped running, another thread
had posted some 70,000 messages to the UI thread, it looks like only the
first, say, 50,000 messages would be processed by the UI thread when it
resume to normal.
Those are big numbers (compared to the old 16-bit limits) :)
How do you know 70,000 messages were posted and only 50,000 were
processed? Did all the PostMessage calls succeed?
Post by lauch2
Anyway, I just want to collect more information about the window message
queue.
An other idea?
To do what?
I assume you've already found the Platform SDK documentation on MSDN,
such as the topic titled "Using Messages and Message Queues".
Dave
Loading...