Ok, I've revised this somewhat.
I was considering the benefits of actually mapping all the code sections into the object storage space and then allowing objects to tunnel to each other through the kernel without needing to actually remap the address space in any way, this sounded reasonably good at first until I remembered that all the so-called "safe languages" are [semi-]interpreted meaning that they would require an interpreter be mapped in which would require library support in the objects and also requires manipulation of the "code" to JIT/interpret it which couldn't really be accomidated in this scheme.
I revised and went to back to the full process space switch but I intend to leverage small address spaces if possible (although I don't know how to isolate the 2 "tasks" from directly accessing each other on architectures without segmentation [ie. everything except x86]). This requires using semi-shared memory to drop the object being operated on inside the "host server"s address space before delivering a pseudo IPC message with a pointer to the object data. The object storage space is now simply a "bank" rather than real address space, this is merely to impose a maximum size of total objects restriction per process.
The trouble with this approach is that it isn't thread safe, having the process be operating on 2 objects at once means there is a possibility for cross sharing and capability escalation however my feelings on this are crossed in that the program is presumed to have decided the object was trustworthy to begin with meaning that it is trusted not to anyway but I still prefer the idea of enforcement but that would be prohibitive of JIT anyway which brings back to the original problem. (I'm not quite willing to have one instance of the server per process tree but that may be a plausible compromise)
However the main design problem I currently have is that capabilities are stored externally to the process yet the process is required to know the interface in order to call the functions, the main difficulty here is that the capabilities are given by other processes rather than being created directly as per [MS-]COM, therefore how could the program know what objects are available without resorting to an interface comparison of each object? Lookups won't work as there may be objects that are derivatives of a given interface as well as more than one of the same interface type.
To try and rationalize the problem more, the kernel's InvokeCapability system call will take some sort of identifier (at the moment this is merely an ID Number) along with the function name and a bunch of parameters to pass, the client will have a proxy, so if it was in C++ the proxy would be a class that looked like the "remote" object, the proxy would store the identifier internally to conceal the system call complexity from the program, now this is all well and good but the problem comes from creating this proxy class to begin with, naturally the program will only recognise certain interfaces and not others so not all interfaces can be proxied directly but who instantiates the classes and how? And where are they put?
This is where I'm quite foggy, my current [extremely vague] idea is that the program will have "hidden" variables of its supported interfaces, eg.
Code: Select all
IGuiWindow **IGuiWindows;
INetSocket **INetSockets;
The init code before main would determine the capabilities and create the proxies and store the pointers in these hidden arrays which the programmer can then look at during the program (Obviously in general useage you would recieve a GUI Factory rather than individual windows...), this however, would require utility functions for searching for particular port/protocol combinations in the NetSockets array which would obviously be preferable to avoid the additional complexity for the programmer. Also, additional capabilities could be added at runtime, for this the best I can think of is a sort of special signal that the runtime library handles automatically and adds a new proxy for the object to the arrays before signalling the program that a new capability is available (probably combined with a pointer to the proxy). This approach seems to be a bit too messy for me though.
Does anyone have a better idea for creation and management of proxies?