Transient OS
Connell Reffo
overview
Transient OS is a time-sharing operating system designed for the Raspberry Pi 3. It uses preemptive round-robin scheduling with configurable time quantums to manage concurrency. The system includes several system calls for memory management and thread control.
example
A project showcasing the capability of this project can be found here. This showcase project is a simulation of Conway's Game of Life on 257 OS Threads. There is one thread for each cell on a 16x16 grid plus one thread for a grid-swap operation.
purpose
This operating system is intended to still be used for very low-level programming somewhat similar to a real-time operating system. Additionally, it was also created to learn more about operating systems and how they work at a hardware and software level.
features
Preemptive Round Robin Scheduling ensures fair CPU time distribution among threads with configurable time quantums.
System Calls provide an essential API for memory management and thread control.
Memory Management consists of a First Fit algorithm for heap allocation and paging (with a page size of 4KB but no virtual memory).
Utilities such as Mutex, Mutex Lock Guard, and Atomic Gaurd provide thread syncronization and atomic operations.
threads
Threads are the fundamental unit of execution in this operating system. Each thread is allocated a single page of memory and is scheduled by the kernel. Threads are not tied to each other, that is, there is no concept of parent and child threads. All threads (except the main startup thread) are created by the user and are managed by the kernel.
User mode threads run at EL0 and do not have access to privileged instructions such as reading and writing to special registers. If a user mode thread attempts to execute a privileged instruction, a segmentation fault is raised and the thread is terminated. They also can only spawn other user mode threads.
Kernel mode threads run at EL1 and have access to privileged instructions and have free reign over the system. The first thread created, the main thread, is a kernel mode thread.
Thread Stack is located at the top of the memory page and grows downwards. The stack is intended to be half the size of the memory page, but this is not enforced and can certainly overflow into the heap.
Thread Heap is located at the bottom of the memory page and grows upwards. The heap is constrained to be the other half of the memory page and cannot grow beyond that. The heap is implemented as a first-fit allocator with a simple free list. The heap is intended to be used for dynamic memory allocation but is prone to fragmentation.
diagrams
Below are diagrams of the overall system memory layout and the heap allocation layout.

