4 ms·
You can check it here, the first ~100 lines are about memory management: https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources/Kernel.Mod.txt https://ww
by badsectoracula 8y ago
You can check it here, the first ~100 lines are about memory management:
https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources/Kernel.Mod.txt https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources...
The exposed procedures (exposed symbols have a star after their name in their declaration) are New (it is treated in a special way by the compiler to remain type safe even if the language itself wouldn't allow it normally), Mark and Scan. It seems that it uses a block allocator that the garbage collector uses itself privately. These procedures use special "GET"and "PUT" procedures which are translated to raw memory access by the compiler (these are also used to access the hardware which is memory mapped). A test for garbage collection is called periodically as seen below (check PROCEDURE GC):
https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources/Oberon.Mod.txt https://www.inf.ethz.ch/personal/wirth/ProjectOberon/Sources...
The collection occurs either when the system is in low memory or some countdown is reached (set by a call to Collect, although looking at the code it seems other bits can change it too).
The rest of the OS just uses the above facilities.