dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit ac09572db0e618d9575da411b3c7b81b7818d233
parent a5673fcc973d3546dd4335bb0508a29aaaa0900b
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed, 20 Jul 2022 15:17:42 -0400

doc: lib or sys?

Mfs/doc/arch.txt | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/fs/doc/arch.txt b/fs/doc/arch.txt @@ -109,3 +109,35 @@ A typical system will spit a prompt and pass the control to /sys/rdln, which reads input line by line and interprets them. The system is yours. + +# lib or sys? + +What's in /lib? What's in /sys? This question can sometimes lead to confusion. + +/lib is for "libraries", a set of mostly stateless logic. /sys is for +subsystems, also a set of logic, but often stateful, centered around one or +more resources. + +Libraries will typically be loaded by apps, subsystems and other libraries with +the help of ?f<< (load file if it's not already loaded). + +Subsystems will be loaded during init.fs. If a unit requires the subsystem, it +will indicate it with "require", which doesn't load anything, but errors out if +the unit isn't loaded. + +Sometimes, the line between the two is fuzzy. These questions will help draw +the line. + +1. Who will decide when we want to load it, the system operator or the +application writer? If it's the sysop, it's a subsystem. + +For example, some applications might needs some words from sys/rdln, but it +doesn't make sense to automatically load it when needed: if the sysop hasn't +specifically decided to load it in its system, this dependency has a lot of +chances to be nonsensical. + +2. Is the unit centered around a resource that needs configuration? If yes, it's +a subsystem. + +For example, sys/scratch is centered around a buffer which can vary in size +depending on what the sysop wants.