Re: Holes in the Java sandbox

Richard M. Smith (rms@pharlap.com)
Sun, 15 Feb 1998 15:02:34 -0500

Date: Sun, 15 Feb 1998 15:02:34 -0500
To: Li Gong <gong@games.eng.sun.com>
From: "Richard M. Smith" <rms@pharlap.com>
Subject: Re: Holes in the Java sandbox
In-Reply-To: <199802142313.PAA28571@games.eng.sun.com>

At 03:13 PM 2/14/98 -0800, Li Gong wrote:

>Resource allocation management is an issue that is not easy to
>translate from requirement to implementation. If it were, something
>would have been done about it by now. I won't go into the details of
>why this is not trivial. We are continuing working on this.

I see why its not an easy problem to solve in general. However
I think that a seat-of-the-pants solution would work 95%+ of
the time if we just talk about a JVM running in a browser.
Under Windows 95, the following JVM limits seem to make
sense to me:

- A JVM will never open more than 16 windows
- A JVM will never spawn more than 64 Win32 threads
- A JVM will never allocate more than 16 megs of memory

The approach here is the same as Netscape does with cookies.
I believe that Navigator won't let a single domain to have more than 4K
bytes of cookies. This limit prevents a hostile or buggy Web server
from filling up user's hard disks.

>By the way, Solaris seems to hold up really well under the applet that
>appears to use many threads. Time to switch to Solaris and possibly
>Sparc? :-)

Not surprising, I guess. Win95 doesn't pretend to be industrial strength.

BTW, I ran some tests with C programs that spawn an infinite number of
threads. I found that Win95 wouldn't let me create more thatn 1,500
threads in a program. The CreateThread call fails with an error.
I hit this limit only if each thread goes to sleep immediately. If I
let each thread run in a do-nothing while loop, Windows 95 crapped
out at about 500 threads. The main thread ran out of CPU cycles
to create new threads.

See ya,
Richard