Scheduling documentation

Introductions

The NEET computers mod has a complex unintuitive system for how it schedules the parsing of instructions, this page is the only documentation you will ever need to gain a complex understanding of how NEET manages its computers!

Tickets

The most material system for scheduling is tickets, when a computer is ticked, its allocated X tickets, of Y size.
From there the computer runs a process on the least burdened computer processing thread, this process starts running Lua code, waiting for Y instructions before expending 1 ticket, once there are no more tickets or there is no more valid lua code to run, the process ends allowing the thread running it to progress to the next computer waiting to be scheduled.

Process Allocation

As described, when a computer received a game tick, for example a placed computer being ticked by its block entity, it will check to see if its in good state to run code (has a loaded filesystem, is on, i.e.), it will find the available processing thread with the smallest queue of processes and append its own ticket spending process to that queue. If the computer already has a process waiting on any processing thread when it ticks it will not queue another, in effect if the threads cant keep up, computers will skip ticks.

Native Libraries

This section of the scheduling documentation is Lua (more specifically YS-Lua) specific, other languages might implement it differently. Within the YS-Lua module, the ticket consuming process, as well as the entire Lua runtime is run in a mixture of C and C++, this code is compiled and a 'binary' for this code exists for each combination of operating system and system architecture the mod supports. The reason for this is the extreme speed gains from keeping the Lua runtime outside the slower java language.