Isolate and System Resource

Thinking ahead to a full implementation of Isolates, where is a design document? Where is a design document for inter-Isolate drivers for opening, reading, writing and closing system resources?

Here is an exercise to understand how Isolate interacts with a system resource, using a TCP/IP socket as an example. Let's say we have a running Linux (or Windows) machine.

Now, we start our Java application (equivalent to Isolate A). It listens on port 8080.

$ java demo &

With our first application running, we start another instance of the same Java application (equivalent to Isolate B).

$ java demo

It attempts to listen on port 8080. What happens? The second instance fails to open port 8080 for listening because it already open by the first instance.

THEREFORE, we can't start each Isolate with its own TCP/IP stack, can we? Two Isolates can't open the same port for listening, right? The bytestream from the network interface card would become corrupt. Rather, we might design a user-space Isolate around inter-Isolate communication. The second Isolate "opens" a socket by sending a message to the system Isolate, "reads" a socket by sending a message, "closes" a socket by sending a message. When the user-space Isolate is destroyed (killed), all of its resources are garbage collected. Plus, resources in the system Isolate must be finallized and garbage-collected.

The system Isolate must refuse to open a server socket when it is already open.

THEREFORE, the system Isolate might have a different classpath than a user-space Isolate. A user-space Isolate might have a socket stream based upon inter-Isolate communication. It might have a file stream based upon inter-Isolate communication. A user-space Isolate might not communicate directly with any system resource.

THEREFORE, it might be possible to isolate parts of the operating system, such as a printer driver, file system driver, video driver, keyboard driver. It might be possible implement the TCP/IP stack in a user-space Isolate. When a driver is Isolate'd, the Isolate can be independently destroyed, upgraded, restarted--without restarting the entire system.

We have SharedStatics

I think the example given above does not quite match the unfinished work on Isolates. The TCP/IP Stack would be (and actually is) SharedStatic, i.e. visible by every Isolate.
Regarding a design document, there is none. There's the Isolate JSR, but nothing specific to JNode. In my opinion writing a design document goes in conjunction with implementing it actually even the over way round: Write the code and javadoc, document it once finished.

E.g. one part that needs cleanup are locked objects on Isolate exit and Levente implemented that some weeks ago. This can be seen as an example for simple patch one could provide for other resources, too. So I subscribe to the view of Steve in the other thread and ask you for your help and code submissions.

gchii : join us !

gchii : I am joining Peter and Steve in their effort to make you join the JNode developers !


my blog : en français, in english or both