Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 3.34 KB

README.md

File metadata and controls

54 lines (42 loc) · 3.34 KB

Kernel documentation

This page is intended for BadgerOS kernel developers. It details the internal kernel APIs and structures.

Index

List of kernel components

These links provide more detail on the scope and requirements per component and their APIs (when implemented).

Component interaction overview

Components in the rows use APIs from components in the columns.

HAL Sched Proc Mem FS Trap
HAL
Sched x
Proc x x x
Mem
FS x
Trap x

Components and their purpose

Hardware abstraction layer

The hardware abstraction layer, or HAL for short, provides a generic interface to various hardware functions, including GPIO, I²C, SPI, FLASH, etc. Other components can then use the HAL to perform the same operations on different hardware without the need for porting them. Take filesystems for example, where one type of filesystem can be stored on almost any kind of media without the need for explicit support from the filesystem driver.

Scheduler

The scheduler manages distribution of CPU time between threads running on the same system. BadgerOS implements a preemptive scheduler; the scheduler takes back control after a predetermined time so one process cannot freeze the entire computer.

Process management

The process management API manages the creation and termination of processes and assigning resources to processes. All resources given to a process are accounted by the process management API so they can be reclaimed when the process exits. The process API has tight relationships with the scheduler and memory management because both threads and memory are resources integral to the existance of processes.

Memory management

All the memory available to the system is handled centrally by the memory manager. The memory manager is responsible for accounting the available memory and distributing said memory between processes, kernel-side caches, kernel stacks and kernel data structures. Memory management also includes the configuration of virtual memory or memory protection, whichever is applicable.

Filesystems

The filesystem component is reponsible for managing all the mounted filesystems. It abstracts the filesystem details away, leaving only a generic interface that applies to all types of filesystem.

Traps and interrupts

Traps and interrupts are low-level mechanisms of the CPU used for error conditions and events respectively. Traps can be illegal instruction, memory access fault, system calls, etc. while interrupts are generated by other hardware like timers, GPIO, SPI, I²C or inter-CPU communication.