thox processes and interactions

Todo

Introduce the concept of runtimes, i.e. Lua files e.g. in /lib/runtimes that run before the program main code to initialize the environment to a standardized environment using the thox native process API. Runtimes could include:

  • Native thox process runtime (nothing).

  • Extended compatibility (use the Lua current functions to give access to obsolete or future utilities, not just those of the current Lua function).

  • CraftOS runtime, which hides RPC calls between functions and constants described by the CC:T reference.

  • Other OS runtimes, such as OPUS runtimes.

The goal is to ease program compatibility while retaining the security offered by the process design, as runtimes are constructs above the native process API. Kind of like “subsystems” in Windows NT.

Such an option (e.g. runtime_path) should be implemented in the os.run(), os.run_file() and os.run_code() functions.

thox provides multitasking, which means that processor time is shared between multiple tasks, grouped in processes, automatically.

Note

This differs massively from CraftOS, which implements a DOS-like monotasking system which implements Terminate and stay resident programs.

When possible, thox multitasking will be pre-emptive, which means that switching between processes can be done without requiring the process to give control back to the system; however, in some circumstances, this cannot be accomplished, therefore thox resorts to simple cooperative multitasking, which requires process to give control back to the system through any system call. For more details, see How this is accomplished in Lua.

In the following sections, we will discuss the following points:

  • The concepts used in this project: processes, contexts and interactions.

  • The native thox runtime API.

  • RPC APIs of native contexts, managed by the thox process manager.

Then, if you want to go more in depth about the thox process manager, you can find information in the following sections:

  • How running and switching between processes is implemented.

  • The manager implementation reference, i.e. how the manager is implemented in terms of functions and objects.

See all of these discussions and references in the following sections: