Sometimes your system hangs because some process enters a busy-loop that does evil things, like allocating huge amounts of memory and causing the swapfile manager to make Windows crawl. In those cases it would be nice to have something that runs in high priority that can kill the offending process. Microsoft addressed this by running winlogon.exe and taskmgr.exe in “High” priority, but that’s just not enough…
RealtimeCmd is a simple program that runs in “Realtime” process priority, idle thread priority (thus lower than any other realtime process, but higher than any non-realtime process) and waits for the hotkey Ctrl-Shift-Alt-WinKey-C (*) (use both hands!). When the hotkey happens, it spawns cmd.exe, in realtime process priority.
Important note: Due to the behavior of the CreateProcess function, programs you run in cmd normally will have Normal priority class. To get them to have Realtime priority class, use the “start” command, i.e.: “start /realtime pskill iexplore” instead of just “pskill iexplore”.
Now I’ll explain how to install it as a Windows service, using the Windows Resource Kit tools instsrv.exe and srvany.exe. (These don’t come with Windows – you have to install the resource kit tools from the Windows CD or from the web.)
C:\Misc>instsrv RealtimeCmd [...]
[...] "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
The service was successfuly added!
Make sure that you go into the Control Panel and use
the Services applet to change the Account Name and
Password that this newly installed service will use
for its Security Context.
C:\Misc>reg add [...]
[...] HKLM\SYSTEM\CurrentControlSet\Services\RealtimeCmd\Parameters [...]
[...] /v Application /d C:\Misc\Tools\RealtimeCmd.exe
The operation completed successfully.
C:\Misc>reg add HKLM\System\CurrentControlSet\Services\RealtimeCmd [...]
[...] /v Type /t REG_DWORD /d 0x110
Value Type exists, overwrite(Yes/No)? y
The operation completed successfully.
C:\Misc>reg query [...]
[...] HKLM\SYSTEM\CurrentControlSet\Services\RealtimeCmd
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RealtimeCmd
Type REG_DWORD 0x110
Start REG_DWORD 0x2
ErrorControl REG_DWORD 0x1
ImagePath REG_EXPAND_SZ C:\Program Files\Windows Resource Kits\Tools\srvany.exe
DisplayName REG_SZ RealtimeCmd
ObjectName REG_SZ LocalSystem
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RealtimeCmd\Parameters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RealtimeCmd\Security
C:\Misc>reg query [...]
[...] HKLM\SYSTEM\CurrentControlSet\Services\RealtimeCmd\Parameters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RealtimeCmd\Parameters
Application REG_SZ C:\Misc\Tools\RealtimeCmd.exe
(*) I was going to use Esc+Ctrl+Tab+Alt+Both Shifts+Num Lock+~, but it was already taken.
May 5, 2007 at 11:35 pm
You need to get a multiproc box; helps -so- much with those annoying runaway programs…
May 6, 2007 at 12:55 am
crog hit reset button
with club