Skip navigation

JSI Tip 0986. How do I tune ill-behaved apps to be good Terminal Server citizens?

If a 16 or 32 bit application uses too many cycles when idle, you can tune the performance by editing the registry. Use Regedt32 to navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\TerminalServer\Compatibility\Applications

Add Key name YourApplicationExe (without the extension). Leave the Class blank.

Add the following 4 Value names as type REG_DWORD entries: (see the SETUP sub-key if you rather Save Key and Restore):

FirstCountMsgQPeeksSleepBadApp - The default is 0xf (15). This is the number of times the application must query the message queue before Terminal Server decides that it is ill-behaved. Decrease this value to put the application to sleep more often, so it uses less CPU time.

MsgQBadAppSleepTimeInMillisec - The default is 0x1 (1). This is the number of milliseconds the application is suspended when Terminal Server has decided that it is ill-behaved. Increase this value to use less CPU time. If this value is zero, polling detection is disabled.

NthCountMsgQPeeksSleepBadApp - The default is 0x5 (5). This is the number of times the application must query the message queue before it is suspended again. Decrease this value to use less CPU time.

Flags - The default is 0x8 (8). The possible values are:

      0x4 (4) for Win16 applications only.
      0x8 (8) for Win32 applications only.
      0xC (12) for either Win16 or Win32 applications.

You should run performance monitor while tuning the application.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.