December 24th, 2009

Why don't we create a special class of programs which can break the normal rules?

In response to a discussion of why the window handle limit is 10,000, commenter Juan wondered why we don’t create a special class of programs which can exceed the 10,000 handle limit and otherwise bypass the normal operation of the system. This is another case of the tragedy of special treatment: Eventually, nothing is special any more. If there were a way for an application to say, “Hey, I don’t want to be constrained by the normal rules that apply to your everyday boring applications,” then every application would simply say it, and the net effect would be that the constraint no longer applies to anybody.

Task Manager conforms to the normal rules for GUI programs because if it marked itself as special, soon everybody would mark themselves as special in order to get the same special treatment. (Besides, the special treatment doesn’t help Task Manager at all, since Task Manager doesn’t create 10,000 handles. The specific issue in the comment is not something Task Manager even knows that it needs to opt out of. All it did was call CreateWindow; Task Manager shouldn’t need to know about the internal implementation of CreateWindow.)

Bonus chatter

: There is already one mechanism for applications to say that a particular class of restrictions should not apply to them.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.

Feedback