Thanks! Originally it only started as an experiment to see how far I could go making an OS in a high-level (higher than C at least) language, I was only planning to build a monotasking DOS system. Around this time, Andreas Kling started to show us his SerenityOS, which was one of the factors propelling me to reach this point. So shout outs to AK!
Yeah! It's pretty fun to develop an OS, albeit time consuming. You should check out the osdev wiki and the Intel/Seagate manuals, they should hopefully get you to the point where your OS can read/write/execute files, you should also take a look at how other kernels do things as a reference and actually implement them in your OS in a way that fits.
Sorry that your account was being rate-limited. It's software filters that do that, based on past activity by trolls. Unfortunately it also sometimes prevents project creators from showing up to discuss their work. I hate that!
We've marked your account legit so this won't happen again.
Oh, I have dabbled in OS dev a tad already actually, although not in a long time. I think if I went for OS dev nowadays, I’d prefer to try and start as an EFI binary because I believe that way you get to start directly in long mode, and have some filesystem drivers to bootstrap with at least. Still, I don’t know if I will ever have the drive (and spare time) to push it as far as you have gotten Lilith.
Right after the global descriptor table is setup and paging is enabled, the GC is then enabled. On every allocation, and whenever the os has no task available to switch to, a gc cycle is performed.
Not really, the kernel and any process written in crystal has a garbage collector, any other userspace process can manage memory however they want to.
Out of the box, Crystal does garbage collection through the boehmgc library, however if you pass in some compiler flags you can get application to not use GC.
As for my OS, I wasn't gonna port libgc, and since I have prior knowledge of building a GC in rust (very badly!) I decided to make a tri-color concurrent, mostly precise (through compiler patches), garbage collector, in Crystal.
I've read up on how luajit does garbage collection (in fact the current gc/allocator with allocation/marking bitmaps is inspired by his tri-color gc. Apart from specifying when the GC should run, I won't be changing anything about the core gc algorithm used in the project anytime soon.
Cool coincidence but nah. Maybe its a reference to the first angel in Evangelion? Maybe its a reference to Adam's wife? Maybe its best girl from Machikado Mazoku?
POSIX-like, not entirely POSIX! There are basic IO syscalls, and some process management calls, but overall I try to take unix as a guideline rather than trying to reimplement one entirely. I also try to take inspiration from other kernels (like fattr (which is equivalent to GetFileAttributes from WinNT), and spawnv from DOS/WinNT).
That's fair. And to be clear, reading "POSIX-like" makes me expect it to act like a unix, but that hardly means that you should be bound to follow that exactly:) If you wanted to set expectations a bit, maybe "partially POSIX-inspired, with other influences from $FOO and $BAR" would be clearer?
Oh wow someone actually posted this! Thanks a lot for the comments and criticisms guys, really means lot to me. Before I go I'll answer some questions, so ask them away!
I’ll echo what everyone else said - SUPER IMPRESSIVE and awe-inspiring work. Thanks for sharing it with the world.
I have one question: While I can read and understand each individual line of code you wrote (go Crystal!) and what each method does, etc., I’m at a total loss for how you knew what and how to build - big picture wise. Can you share a bit about your process for building the mental model of this? How do you know where to start, what modules to build, what’s needed / what’s already there, etc? What roadmap (if any) are you using?
I’m just amazed at how something like this comes together and would love to learn a bit more about the process a single dev uses to build it.
You can checkout what I replied to jchw. But tldr, wanted to do DOS => got ambitious => made it multitasking => got more ambitious => added graphics and guis.
Currently it's pretty barren driver-wise, I currently have a FAT16 driver, a keyboard/mouse driver, some basic code to handle core architecture hardware and that's it. I really want to have CDROM support, a network driver (ne2k or e1000), an audio driver (sound blaster?) and an actual file system.
My roadmap is go with the flow. If I want a text editor, I'll focus on building a text editor. If I want to play doom I'll port doom (but I dont so I won't :^)
Thanks but the code isn't that clean, there are hacks here and there and it isn't organized as clearly as I wanted to but feel free to look through it.
Precise GC information, the crystal compiler prepends a dword/qword value indicating an class' typeid upon allocation. I decided to patch the compiler to generate 2 functions, one that outputs the class' size based on a typeid, another one that outputs the offsets of each pointer in that class as a bitmap, based on a typeid.
The compiler also generates a null-terminated array of pointers pointing to the offsets of global variables.
No iso images yet, I haven't implemented iso9660 filesystem support, but it's coming soon?