Skip to content

WIP Implement preemptive multitasking#5

Open
evg-zhabotinsky wants to merge 3 commits intomaster-MC1.10from
preemptive
Open

WIP Implement preemptive multitasking#5
evg-zhabotinsky wants to merge 3 commits intomaster-MC1.10from
preemptive

Conversation

@evg-zhabotinsky
Copy link
Owner

@evg-zhabotinsky evg-zhabotinsky commented Jan 28, 2019

  • Modify Eris to support yielding from Lua hooks and persisting coroutines yielded in that manner.
    • Make sure that implementation is reliable (no known problems as of yet)
    • Safeguard against downgrading? (Currently, unpersisting hook-yielded coroutines with unmodified Eris would probably crash and burn.)
    • Package all final builds of native libs (currently included are release builds for Linux on Intel CPUs)
    • Also patch LuaJ to support the same, only without persistence.
  • Make basic functionality work: computers preempt and then can resume.
    • Fix calls to Java functions breaking persistence.
    • Backwards compatible "watchdog timer" for programs that relied on hung coroutines dying.
  • Fair scheduling of computers
    • Figure out what is "fair"?
  • Provide "timer interrupt" and compute time usage stats to user code.
    • Make the "watchdog timer" just the default interrupt handler.
  • Advanced userspace support in OpenOS?

Other places of interest:

Rebuilding OC takes time.
Restarting MC with all mods and reloading the world takes time.
Applying machine.lua changes requires doing all above... Not any more!
Just put your machine.lua at <world save>/opencomputers/machine.lua
and reboot any OC computer to apply changes to it.
WIP: Linux libraries only, not even final version.
See fnuecke/eris#30

Standard debug.sethook() now accepts 'y' in its mask string.
Adding it and returning true from hook will yield the coroutine.
That allows for preemptive multitasking, at the very least.

Also, Eris now can persist coroutines yielded in the above manner.
Hook-yielding near (inside?!) a native Java call breaks persistence,
will have to wrap them with some manner of non-hooked code.

No real scheduling is implemented, just added automatic sysyields
in addition to manual that already were there.
@asiekierka
Copy link

That is some very exciting work. Don't worry about LuaJ - its existence is one giant "best-effort" anyway. You might find help/support on the OpenComputers IRC. I recommend looking into https://github.com/asiekierka/OpenComputers/tree/movingblocks-jnlua - it's a WIP branch which lets you use the Eris/JNLua repos on the MovingBlocks org - those are actually maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants