Pushing Operating System Limits

October 1, 2007

Raymond Chen notes that if you have to ask where the operating system limits are, you're probably doing something wrong:

If you're nesting windows more than 50 levels deep or nesting menus more than 25 levels deep or creating a dialog box with more than 65535 controls, or nesting tree-view items more than 255 levels deep, then your user interface design is in serious need of rethought, because you just created a usability nightmare.

If you have to ask about the maximum number of threads a process can create or the maximum length of a command line or the maximum size of an environment block or the maximum amount of data you can store in the registry, then you probably have some rather serious design flaws in your program.

I'm not saying that knowing the limits isn't useful, but in many cases, if you have to ask, you can't afford it.

In general, I agree with Raymond. Asking these kinds of questions definitely raises red flags. Edge conditions should never be a goal, and if your design is skirting that close to an operating system edge condition, you're either doing something incredibly brilliant or incredibly stupid. Guess which one is more common?

However, it can also be surprising how quickly you can run into operating system limits-- even when you're not doing anything that unusual.

When researching blog posts, I tend to open a lot of browser windows and tabs. At least twice per week, I have so many browsers and tabs open that I run into some internal limitation of the browser and I can't open any more. My system gets a little wonky in this state, too: right-clicking no longer shows a menu, and I'm prevented from launching other applications. But if I close a few errant browser windows or tabs, everything goes back to normal.

I prefer to use Internet Explorer for day-to-day browsing chores, but it appears that IE 7 is particularly vulnerable to these limitations. I ran a quick test in which I opened as many instances of the Yahoo home page as I could, with nothing else running:

Maximum number of IE7 windows I can open39
Maximum number of IE7 tabs I can open47

I don't think having 47 typical web pages open, spread across a couple instances of Internet Explorer on my three monitors, is so unreasonable. And yet that's a hard limit I run into on a semi-regular basis. It's annoying. It looks like IE6 had a similar limit; Theodore Smith found that he could only open 38 pages before new windows were frozen. Firefox fares quite a bit better in the same test:

Maximum number of Firefox 2 windows I can open55
Maximum number of Firefox 2 tabs I can open100+

These aren't hard limits in Firefox; they're practical limits. After I opened 55 Firefox windows, Vista automatically kicked me into Vista Basic mode due to Aero performance degradation. I was unable to close all the instances of Firefox, and I had to kill the task. Tabs worked better; I got bored opening new Yahoo homepage tabs after about seventy and gave up. I was able to close all the tabs without incident. I'm guessing you could have at least a hundred tabs open in Firefox before something suitably weird happened.

So we've learned that Internet Explorer sucks, right? Maybe. The results I saw are largely due to a key architectural difference between the two browsers. IE allows you to choose between opening web pages in the same iexplore.exe process (Open New Tab, Open New Window), or opening web pages in a new, isolated instance of iexplore.exe. Unlike IE, Firefox only allows one Firefox.exe process, ever. This clearly helps it scale better. But there is a downside: if any web page crashes, it will take down the entire firefox.exe process and every other web page you have open.

I understand the need for practical limits in the operating system. Most of the limits Raymond cites are so high that they're borderline absurd. Can you imagine subjecting a user to a menu with 254 nesting levels? Open a zillion copies of notepad, and you'll eventually have problems, too. I get that. The point is to keep those operating system limits far enough above typical usage that developers and users-- even power users-- aren't likely to run into them.

I'm not sure if we're running into an application or operating system limit here; I suspect a little bit of both. Still, I'm disappointed. A limit of only 47 tabbed web pages open at any time under Internet Explorer 7 seems artificially and unacceptably low to me. The introduction of the tabbed browsing metaphor makes it much more likely that users will open lots of web pages at the same time. I'd expect the developers on the IE team to test their application for moderately heavy usage scenarios like this. It's another case of failing to test with a reasonably large data set.

Posted by Jeff Atwood
107 Comments

Right now, I'm running up against two limitations in Windows XP (sp2):
- 65K or so limit on the number of nodes in the Micro$oft treeview control. There's a lot of stuff in the Windows registry under HKLM\Software\Classes\Interface, and REGEDIT.EXE's treeview just gives up in the area of the ones named {10...} and gets wonky after that.
- REGEDIT.EXE can export a string key that contains a CR and/or LF character into a .REG file, but it won't put any text in a string value if the .REG entry has a CR or LF character in it. So, I have a .REG file I just exported from REGEDIT that REGEDIT won't import properly.

BTW, if anybody has an idea about:
- a better REGEDIT tool
- a patch or fix for Microsoft's treeview control limitation
- a way to put the CR/LF back in the registry from a .REG file (without writing my own .EXE)
then please don't be shy.

Thanks!

Jeff J. on June 4, 2008 4:17 AM

@Eam - It's not mental, it's just the result of some usage scenarios. Jeff makes fun of me for having way more than 50 tabs open at any given time. It's really useful when you're researching several things over the course of weeks or months. I find bookmarks / del.icio.us / etc. don't work for me because I forget about things, so keeping an open tab is like a live bookmark.

I like Firefox's tab handling features quite a bit more - you can tell that IE's tabs were bolted on, whereas Firefox had them from the start. Firefox saves sessions between crashes or reboots, and tools like the Scrapbook extension integrate well with tabs.

Again, though, it's all usage. If you're researching a lot of topics over a period of time, large numbers of tabs can be a big productivity booster. I've only got 40 open tabs on this machine, but the three on my desktop have over 120.

Jon Galloway on February 6, 2010 10:13 PM

There are though other operating system limits that you can easily hit when it's not so obvious you're doing something wrong.

One that I've frequently seen surprise even experienced programmers occurs with Unix/Linux filesystems: the maximum number of subdirectories per directory. Modern filesystems are wonderful special purpose databases, and it is usually best to use them when you need to store a large number of files; say rather than reinventing some kind of database. But you do need to be careful about how you structure your directory tree.

In Unix the filenames "." and ".." are really not very special at all. They are in fact just files (i-nodes) stored on disk, exactly like "hello.txt" might be. Specifically "." is a hard link to the current directory and ".." is a hard link to the parent directory. The surprise occurs because there is a limit to the number of hard links any file may have, and that limit is usually quite small, around 4096 for many Unix variants (an historic artifact of fixed-size fields). Since every subdirectory contains it's own ".." file and all of them are really just hard links to the parent directory, you end up with a rather small limit on the number of subdirectories you can put in any directory. Sure you can easily put a million files in one directory, but not so with subdirectories.

Deron Meranda on February 6, 2010 10:13 PM

I currently have 202 Firefox windows open. No problems. I would open more, but I got bored. Performance of Firefox is a little slower, but still very usable, and Other applications are behaving quite normally.

This machine is less than 1.8Ghz, and has only 512M of memory. No special tweaking required.

I am on Linux, though, and that may have something to do with it, but I am running the nice big pig known as KDE along with a media player, and a couple of editors.

Windows, although it is easy at the basics, quickly becomes difficult and unstable as you reach the edge cases. Also, although you have to touch things more often in Linux, they are better documented, and simpler to do when you do.

Just for the record, the only thing like that I have done at all on this system is that I added repositories to my software sources to make it so that I can install things in a nice lazy way. No horrendous registry editor, just a simple GUI where I had to enter the URL of the repository. I guess I could have been bold and copy/pasted it into a text file.

Grant Johnson on February 6, 2010 10:13 PM

I can open 153 firefox windoes - no problems so far - xpsp2, 3GB ram

Steve Bolton on February 6, 2010 10:13 PM

If you have so many tabs on your IE tab-bar or so many apps on your task bar that you can't read their titles without mousing over for tool-tips you have too many open!

Jason Stangroome on February 6, 2010 10:13 PM

All this talk about pushing OS limits and making better Alt-Tab behaviour and adding incremental search... this is a meta-problem that you've created yourself. Since you're familiar with TDWTF I assume that you've probably read The Complicator's Gloves:
http://worsethanfailure.com/Articles/The_Complicator_0x27_s_Gloves.aspx)

There's a ridiculously simple solution to all of this nonsense and it's called "bookmarking links you want to visit later instead of opening them now". It takes 3 seconds to create a bookmark folder called "Blog post 2007-10-02", and when you right-click a link, go to "Bookmark this link" or "Add to favorites".

The cringe factor in the posts about these browsing habits is very high for me. Higher than Joel's "Wasabi". One minute you're talking about the need for better usability and ergonomics, and the next minute you're telling us about about a setup that would make even the most hardcore code monkeys cry. I have to concur with the other readers telling you to get yourself organized; it's a miracle that you're able to get any work done at all this way!

Aaron G on February 6, 2010 10:13 PM

«Back

The comments to this entry are closed.