contents
- Process Global Information Problem
- Global Variables Problem
- C Extension Problem
- Path Problem
- Signal Problem
- Other Information
Implementation Issues
Process Global Information Problem
- A process have several VMs.
- However there are some "Process Global Information" which should be had each VM
- example: Global variables, working directory, signal
Global Variables Problem
- Problem: Some C codes use gloval variables to store Ruby Objects.
- Because Ruby Objects are belong to each VMs, this is serious problem for MVM on C Ruby.
- Solution: VM local storage C API
- We made VM local storage C API
- rb_vm_specific_ptr(key) returns pointer to VM local storage related to keys
- Keys should be shared by each VMs (Keys are initialized by process level initializer)
- mvm/include/public_object.h includes major global object macros
- Status: Done
/* mvm/include/public_object.h */
enum ruby_public_object_vmkey {
rb_vmkey_mKernel,
#define rb_mKernel (*rb_vm_specific_ptr(rb_vmkey_mKernel))
...
};
C Extension Problem
- Problem: global variable problem on core interpreter can be solved with above solution, but not on C extensions
- C extension libraries also use global variables
- Solution: two phase initialization
- Current CRuby has initialize mechanism for C extensions: calling Init_foo() for foo library
- MVM needs two phase initialization
- Init_foo() called when foo library loaded at first
- InitVM_foo() called when foo library is required by each VMs.
- Compatibility:
- If foo library has only Init_foo() initializer, foo libraries are used in main VM (first VM in process)
- Status: Doing
- Rewriting loading mechanism
Path Problem
- Problem: working directory is process global information
- Solution: all path related apis are replaced by *at() APIs (openat(), and so on).
- Portability: openat() and other APIs are still new for most of OSs.
- If there is no such APIs, old APIs (open()) with modifying path string.
Signal Problem
- Problem: Signal is delivered to a process, not for VMs.
- Solution: Clarify "out of VM" and "VM internal".
- Call "out of VM" as "Driver" (VM user)
- Call "VM internal" as simply VM
- Signal handler shoud be set by driver
- Driver should deliver a signal information to each VMs with "Driver <-> VM" event communication APIs.
- Status: Done
Other Information
- Problem: there are other information which are process global
- Status: Under review
Last modified: 2008-12-24