Tibbo OS (TiOS)
Most Tibbo programmable devices run TiOS (Tibbo OS) — our proprietary, lightweight operating system. TiOS is an extremely efficient, event-based, two-process system.
The first process, also known as the master process, takes care of all real-time tasks (like TCP/IP and serial communications). The second process implements a software virtual machine (VM). The VM is responsible for executing p-code (pseudo-code, a.k.a. bytecode), a kind of machine code into which your Tibbo BASIC/C applications compile.
TiOS is a single-application system: only one compiled application can be executed at any given time.
Tibbo BASIC/C applications are sandboxed: they run within the VM's confines and are prevented from derailing TiOS. TiOS always has complete control over your application.
TiOS includes an upload and debug interface, allowing you to upload a compiled application binary to the device and then control the VM with commands sent over the network.
Events and Event-Based Execution
Events are a core concept in TiOS. They are always the only way in which any code gets executed.
Every TiOS device maintains an event queue. Events are registered by the master process, go into the queue, and are taken out of the other end of the queue by the VM.
Whenever an event is taken out of the queue, the VM calls an event handler for this event, if such a handler is defined in your application. Event handlers are procedures of Tibbo BASIC and Tibbo C.
Execution is single-threaded (i.e., there is only one event queue). All events begin executing in the exact order in which they were queued.
However, there is a way to execute events out of the standard order by using the doevents statement. This is an advanced feature that we'll explore more in-depth later.