At 10:40 PM 2/3/00 -0700, Patrick Tullmann <[EMAIL PROTECTED]> wrote:
>One nit on your definition of class version.  Two classes are the same
>only if the bytecode is identical and if all the referenced classes
>are identical.

I believe the specification meant Class File, not Class:

"Version x of Class File A is equal to version y of Class File A if and
only if x is exactly the same as y."

All class files in RAM are read-only, immutable byte arrays. If the
standard class libraries represent 4MB of class files, it is possible to
load 4MB of class files once rather than once per process.

As a read-only byte array, a class file can be internalized. In the same
way that the Java Virtual Machine uses String.intern() to save memory for
instances of String, a custom class loader for JOS could use Class.intern()
to save memory for class files.

The JOS version of defineClass() would compare the given class file to
class files that have already been defined on the system. The kernel
process would return a system-wide copy of the class file, eliminating
duplicates of the same exact class.

A kernel/virtual machine could easily save RAM by using a class file cache.
The class files do not need to remain in RAM permanently, but virtually.
Class files can be swapped out to disk, swapped in from disk only when they
are needed.

It does not matter where the class file came from. Even when a class file
is downloaded across the network, if it exactly matches a class file in the
class file cache, the existing copy of the class file in the cache will be
used. The class file cache can be persistent, enabling the
processor-intensive verification of every class file once, rather than once
per process.

An instance of java.lang.Class is not cached and is not cache-able. Each
instance of java.lang.Class depends on its process and class loader.

>From my research in BCNI, a new virtual machine is required. A traditional
JVM cannot save RAM by internalizing all class files. The custom class
loader does not load class files but loads process-specific instances of
java.lang.Class. Internalizing instances of java.lang.Class would not save RAM.


_______________________________________________
Kernel maillist  -  [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/kernel

Reply via email to