[kaffe] sharing classpath

Chris Gray chris.gray@kiffer.be
Mon Feb 16 12:58:02 2004


On Sunday 15 February 2004 16:43, pancake wrote:
> Hello! I'm new here.
>
> This is a optimization proposal for kaffe.
>
> The main idea is to share all the classpath in a server, running at
> localhost (or remote) that shares the classpath for all the VMs running on
> the same machine / network.
>
> By this way we don't have to load all the classes for every VM. Only one
> time for all VM. Of course that's only the classpath, because, every VM
> have their own memory space.

What about the static variables of those classes?  They're separate for each 
VM, right?

Associated with each class is an instance of java.lang.Class . This too 
probably needs to be per-VM.

IOW you need a separate heap for each VM, and everything that is somehow 
connected with the (a) heap needs to be per-VM. Seperating out the per-VM 
stuff from the sharable stuff will be a non-trivial exercise. Have fun. :)

> Using this scheme kaffe will only load 1 time all the classes, and will
> share this classes to all the clients.
>
> What do you think about that?

It's a variation on the Java Isolation API theme: 
<http://www.jcp.org/en/jsr/detail?id=121>. IMO it's most useful if you want 
to create the effect of multiple quasi-independent VMs on devices with 
limited memory; if you cared more about memory but less about isolation you 
would just run everything on one VM (maybe 1 ThreadGroup per application), if 
you cared less about memory but more about isolation you would just run 
multiple VMs.

You will also gain something in startup times for the second and subsequent 
applications to be run, which is an advantage on slow CPUs (e.g. 48 MHz) and 
when the life cycle of each Kaffe VM is very short (e.g. a single HTTP 
transaction).

-- 
Chris Gray                                  /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi              http://www.kiffer.be/k/
chris.gray@kiffer.be                                      +32 477 599 703