You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JerryScript only owns the only 1 heap in total for all JavaScript objects and byte codes as possible. Assuming that no new byte code is generated, even there is many JavaScript objects are changed at this heap, such that we can't get most use of the copy-on-write improvements when using child process.
Background at YodaOS
And at YodaOS, the child_process module is used by creating the application, it should basically use the absolute independent instance JerryScript instance. It takes more time to fork and more unnecessary memory for built-ins and by-default packages like @yoda/property, @yodaos/mediaplayer and @yodaos/application.
So I'm proposing a way to make more sharable parts between VMs on different processes.
Heap API
We can introduce a heap API which provides create, destroy and freeze functions.
create() is to create the heap, and then are usable for VM.
destroy() is to flag this heap is destroyed, the new objects are not possible to use that, and the old objects should be migrated to others at next GC.
freeze() is to flag this heap is read-only at this timepoint, it'll do:
the last GC, to make sure there is no unneeded objects are still existed,
compress the memory layout and make this heap is compact as possible.
flag this heap is not able to create new object, every object from this heap should be created at another available unfrozen heaps.
Within the Heap API, the Node.js seed should create the seed heap, and load some usual packages for applications, then just call freeze(), then the forked processes could make use of these objects by the copy-on-write feature. However we have to resolve the following problems:
How to use the heaps(frozen) at JerryScript.
How to implement the object creations from the frozen heap to other heaps.
Maybe there are more memory leaks could be occurred at frozen heaps?
JerryScript only owns the only 1 heap in total for all JavaScript objects and byte codes as possible. Assuming that no new byte code is generated, even there is many JavaScript objects are changed at this heap, such that we can't get most use of the copy-on-write improvements when using child process.
Background at YodaOS
And at YodaOS, the
child_process
module is used by creating the application, it should basically use the absolute independent instance JerryScript instance. It takes more time to fork and more unnecessary memory for built-ins and by-default packages like@yoda/property
,@yodaos/mediaplayer
and@yodaos/application
.So I'm proposing a way to make more sharable parts between VMs on different processes.
Heap API
We can introduce a heap API which provides create, destroy and freeze functions.
create()
is to create the heap, and then are usable for VM.destroy()
is to flag this heap is destroyed, the new objects are not possible to use that, and the old objects should be migrated to others at next GC.freeze()
is to flag this heap is read-only at this timepoint, it'll do:Within the Heap API, the Node.js seed should create the seed heap, and load some usual packages for applications, then just call
freeze()
, then the forked processes could make use of these objects by the copy-on-write feature. However we have to resolve the following problems:@yodaos-project/js @algebrait Any thoughts?
The text was updated successfully, but these errors were encountered: