Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terminology and boundaries RFC #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

moosingin3space
Copy link

@moosingin3space moosingin3space commented Oct 12, 2018

Copy link
Contributor

@lachlansneff lachlansneff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few questions and notes.

proposes we define the following terms to refer to parts of our OS, adapted
from [EROS](https://web.archive.org/web/20160412201504/http://www.coyotos.org/docs/misc/eros-structure.pdf):
the _kernel_, which implements threading and inter-proces communication (IPC)
as a wasm module, the _nucleus_, which implements a small wasm JIT natively,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, the kernel will be a wasm module that runs on the nucleus?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this has been clarified in my latest revision.

from [EROS](https://web.archive.org/web/20160412201504/http://www.coyotos.org/docs/misc/eros-structure.pdf):
the _kernel_, which implements threading and inter-proces communication (IPC)
as a wasm module, the _nucleus_, which implements a small wasm JIT natively,
and the _firmament_, which specifies IPC interfaces for drivers to implement.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the firmament an actual "thing", or just a way to define interfaces between drivers and processes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The firmament would be the equivalent of the syscall boundary in a traditional OS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

RFCs.
- The _nucleus_, which implements a small WebAssembly runtime in native code. A
nucleus will implement the minimal set of hardware interfaces required by the
kernel and will likely resemble an exokernel on its surface. A nucleus need not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call about the exokernel-like interface

The Nebulet operating system architecture is defined in terms of four
components:

- The _kernel_, which implements the core functionality of a microkernel OS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be clearer about whether the kernel is a wasm module or not?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in latest commit.


interface EthernetNic {
fn send(&mut self, pkt: EthernetPacket) -> Result<()>;
fn send_inplace(&mut self, func: impl Fn(&mut EthernetPacket) -> Result<()>) -> Result<()>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious how send_inplace would work. The user supplies it a function that takes a EthernetPacket reference?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See link for an example of a similar function. The idea here is that the network driver can allocate a packet located inside its Tx queue, then the application modifies the packet.
https://github.com/libpnet/libpnet/blob/master/pnet_datalink/src/linux.rs#L231

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting! I hadn't thought of that. It'd be difficult to get the packet into the other wasm linear memory without copying, but could be possible through page flipping.

# Drawbacks
[drawbacks]: #drawbacks

Implementing all drivers as WebAssembly applications may not be able to provide
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an important thing to think about. I'm leaning towards being able to dynamically load (or at startup only, depending on the security model) clif ir for drivers without sandboxing overhead, but this remains to be seen.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As someone with both a security and networking background, I would argue in favor of statically-compiled drivers, with the nucleus implementing the firmament. That said, I wonder if we can somehow have it both ways.

Copy link
Contributor

@lachlansneff lachlansneff Oct 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm okay with that. I suppose recompiling the nucleus for each different use-case is fine.

thread/process scheduling and isolation, and inter-process communication
(IPC). These two pieces of functionality will be further specified in future
RFCs.
- The _nucleus_, which implements a small WebAssembly runtime in native code. A
Copy link
Contributor

@lachlansneff lachlansneff Oct 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the nucleus is to contain the webassembly compiler and runtime, which are largely architecture independent, should we break it up further? That is, into the compiler/runtime and the HAL?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Another boundary, yay!

@lachlansneff
Copy link
Contributor

Thinking about it again, I'm attempting to figure out how we'd implement a microkernel in wasm. So, obviously, it would use the nucleus' hal interface and whatnot, but still. Where is that line drawn? I think it's a good idea to split up the components, but the kernel should be native.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants