Skip to content

EbbRT System Interface (Proposal)

Jim Cadden edited this page Feb 3, 2018 · 7 revisions

This document proposes organizing the distributed system components of EbbRT behind a shared ebbrt:sys namespace. The interfaces, objects, and Ebbs included in the ebbrt:sys namespace would be those responsible for cross-node and system-wide actions.

In particular, the following existing Ebbs would be moved/reorganized under the ebbrt::sys namespace:

  • NodeAllocator
  • PoolAllocator
  • Runtime
  • Messenger
  • GlobalIdMap

New Interface

Instead of exposing one or many static Ebb references (e.g., ebbrt::node_allocator->Alloc()), a standard set of system-wide actions will be made available via static interfaces, included by a single header: (#include <ebbrt/Sys.h>).

These methods will not replace the functionality of any existing Ebbs (like those listed above). Instead, the "system" methods with implemented using existing static EbbRefs. Existing ebbs will be still accessed directly by programmers through the appropriate headers (e.g., #include <ebbrt/sys/NodeAllocator.h)

Static Methods

ebbrt::sys::GetNodeCount();
ebbrt::sys::GetNodeInfo(nid);
ebbrt::sys::GetSysInfo();
ebbrt::sys::AllocateNode(ninfo);
ebbrt::sys::AllocateNodeSet(ninfo, count);
ebbrt::sys::ReleaseNode(nid);
ebbrt::sys::ReleaseNodeSet(vector<nid>);
ebbrt::sys::IdMap::Set(EbbId, val);
ebbrt::sys::IdMap::Get(EbbId);

Info Structures

sys::info{}

Globally accessible system information (read-only):

  • total_native_nodes
  • total_hosted_nodes
  • total_cpu
  • total_ram

sys::ninfo{}

Node-specific information (read-only)

  • nid
  • type {native,hosted}
  • has_frontend
  • frontend_ip
  • local_cpu
  • local_ram

System I/O

Standard I/O streams that are shared across all nodes.

sys::cout & sys::cerr

By default, system-wide out and error streams are forwarded (via Messenger) to the stdin and stderr of the hosted front-end process (otherwise, to the local node's stdout/stderr). The could be configurable at a system level.

#include <ebbrt/Sys.h>

void Foo( int bar ){

 if( bar < 0 ){
   ebbrt::sys::cerr <<  "Warning: negative bar" << std::endl;
 }
  ebbrt::sys::cout << "We have " << bar << " bars" << std::endl;
}

An endl would trigger the stream to flush and send the message

sys::cin

Not yet sure how/if sys::cin should work...

System Log

An possible extension to the standard system I/O is a simple log interface, which will dump messages to system's stdout but with node-specific tag.

ebbrt::sys::log

// this code executes on native node bringup
ebbrt::sys::log <<  "Finish Boot" << std::endl;

if( ebbrt::sys::GetMyNodeId() == 3 ){
  ebbrt::sys::log <<  "Ok!" << std::endl;
}

As each nodes boots the stdout on the front-end would appear as follows:

syslog[node 1]: Finished Boot
syslog[node 3]: Finished Boot
syslog[node 3]: Ok! 
syslog[node 2]: Finished Boot
syslog[node 4]: Finished Boot