Jump to page content

Bug of the moment 2007-10-26


You would assume that every multitasking operating system will have a way to instruct a program to close. On Linux and UNIX, you can send it a SIGTERM signal. On Mac OS, you can send it a ‘quit’ Apple Event.

A termination signal or message works regardless of whether the program is graphical, console or a daemon, and whether it’s visible or not. Visible and background Mac apps all respond identically to a quit request; for example, you can list and close all Mac apps including background tasks (“Hintergrundprogramme”) using a program such as Peek-a-Boo, or Quit CSM:

But how about Windows? How do you close a Windows program that has no open windows? Process Explorer’s view of “kill”, the same as Task Manager’s “End Task”, is simply the obliteration of the program in question:

Yesterday, I discovered an instance of Internet Explorer running in the background with no open windows. I could obliterate it, but I would rather close it cleanly. Microsoft provide their own kill.exe tool for closing processes, so I invoked it to close this copy of Internet Explorer:

After repeating the same command 6 times Internet Explorer finally closed (it turned red in Process Explorer and disappeared; there’s no other way to tell).

Windows itself doesn’t have any problems getting processes to close, for example during logout, but whatever it is they do at logout, isn’t used in the kill tool. Windows is a weird system, clearly reliant on a whole host of hidden windows to function. Each time you invoke kill, it closes the program’s topmost window, or whichever window happens to be nearest. If closing that window quits the whole process, that’s a bonus.

For example, open Outlook Express, click Create Mail, and then try to close it via kill:

Some programs lead you on a merry dance and outright refuse to go away, including Explorer and NTVDM:

I’ve petitioned Mark Russinovich to include a safe process close feature to Process Explorer, but he’s not listening. I don’t know how process closing is supposed to work, but I somehow doubt that kill is an indictment that Microsoft have no idea. Windows can close processes if it wants to, as can some installers, but as a user, you are somehow not meant to have this privilege. When Explorer leaks BROWSEUI.DLL threads, I would love to safely terminate and restart Explorer, but as you can see above, it’s impossible to do anything but nuke it.1

As an aside, kill.exe has since XP been superceded by taskkill.exe which is plagued with the same problem as kill.exe, and lumbered with confusing syntax for good measure.

Once again, Windows displays the delicious irony of the misconception that Macs are hard to understand. On a Mac, closing any process, even a background task such as Time Synchronizer, is as trivial as:

tell application "Time Synchronizer" to quit

Footnotes

  1. In fact, Explorer is secretly designed for safe close. In XP, go to Start → Turn Off Computer, then hold control, shift and alt while clicking Cancel: Explorer will safely exit. You can load it anew from Task Manager or Process Explorer.

Posted 26th October 2007 – Comments and questions?