The little book about OS development
littleosbook.github.io
littleosbook.github.io
Seriously, I would highly recommend tinkering around with a hobby OS. I used it as an opportunity to learn Rust and I got more than I bargained for. Now, I feel somewhat comfortable in Rust AND I can throw more double and triple faults than most people in the world.
This one?
(Oysters all the way down, I know)
The compilers generated bytecode, and the CPUs were microcoded.
So the first boot phase was to load the microcode into the CPU, and then boot into Smalltalk, Interlisp-D, Mesa, Cedar environments.
There was a project that tried to be a future Amiga OS replacement that was also bytecode based with JIT,
https://news.ycombinator.com/item?id=9806607
Inferno with Limbo, another example, get wasm to replace disVM role.
Or like ART on Android, and so on.
Ah, IBM i (née AS/400) is also bytecode based with a JIT on the kernel.
Lots of examples out there, UNIX is not the only way.
The old xv6 is x86-based and it's not officialy maintained anymore.
Or Xinu: https://xinu.cs.purdue.edu. There's a BeagleBone (ARM) port.
If you really did want to work with an existing OS for actual research/experimentation purposes, and you're a fan of C, I would go with Plan 9/9front. There's a reason Bell Labs ditched Unix--because it wasn't a worthy research platform anymore.
For something non-X86, try digging at: http://wiki.osdev.org/Projects Perhaps you can find something suits your preference.
Which is sensible. There's way too much legacy crap and ugliness that needs to be dealt with in that ISA to distract from the purpose of the project, which is to teach OS development.
- Get multitasking working in x86 since there are a ton of guides for that. Learn OSdev concepts.
- Read the ARMARM. It's many thousands of pages of dense technical material, nearly everything you need to get started. The only parts it doesn't cover are boot media/formats and peripherals.
There aren't good resources for ARM osdev because the environment is not standardized at all. ARM chips are used everywhere and you're often targeting specific boards, not chips. Writing the ARM-specific stuff is only half the battle.
RPC, the input stack, the graphics stack, the network stack, audio, profiling, telemetry, scheduling, UI toolkits, security, service management, application management, etc.
If you want to learn these things you will need to read the documentation and source code for other OSs.
But for beginner, I think xv6 is sufficient: https://github.com/mit-pdos/xv6-public
A rather small codebase, pretty well documented, easily buildable without building your own custom GCC, docker etc etc
Wishing x86 on students is sincerely such a sadistic act. Just pick an arbitrary isa that's easier to reason about (read: basically anything after 1990 not designed by intel) and stick to it.
There are also really good virtual machines and emulators available.
Most of the weirdness came in in the 286 and can be more or less ignored. The parts that can't be ignored happen mostly during initialization.
If you want to baby step your way towards assembler and hw programming, DOSBox + an IDE/debugger setup from the late 80's/early 90's is really not a bad combo. That could be Turbo/Borland Pascal or C(++) with Turbo Debugger and Turbo Assembler, for example. You get a running environment, you have direct access to the hardware (DOS won't stop you), you can access it from Pascal/C, you can use inline assembler in both, and you can use external assembly files if you want. You can even successfully single-step and use breakpoints a lot of the time.
A Raspberry Pi or similar is a good alternative. I don't think any non-ARM platform is.
So you read a tutorial and it spends about 90% of its time talking about an area that really isn't that interesting compared to other areas. I just don't think that's very compelling at all.
I say this having my own hobby OS which I've ported to four architectures (m68k, amd64, aarch64, riscv). At the moment I'm working on a TCP/IP stack which has been really enjoyable and I've learnt a great deal in doing this already. Other fun areas have been virtual memory and page replacement, designing asychronous I/O facilities, and IPC mechanisms, as well as appropriate synchronisation for each (synchronisation alone is a very deep topic, and there's considerable scope for innovation with techniques like safe memory reclamation.) Others may differ, but in these I find a lot more of interest than x86 minutiae.
I wish I still had the source code for the “OS” I made as a teenager. I got as far as writing an MBR boot loader, switching to protected mode, displaying characters on the screen, and keyboard input. I highly recommend it if you’re looking for a fun challenge.
https://www.amazon.com/Developing-32-Bit-Operating-System-Cd...
Something similar by Ben Eater (not with game development, though): https://youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXNR0z1...
Here is someone's take on MikanOS [0] https://github.com/uchan-nos/mikanos
And another one on 30-days Homemade OS [1] https://github.com/kamaboko123/30daysOS
An attempt to translate "30-days Homemade OS" [1] to English but it didn't get far https://github.com/handmade-osdev/os-in-30-days
I do not know of any English book nor article that go this far, except Fusion but the graphical environment chapter is not done yet [2]
[0] https://www.amazon.co.jp/dp/4839975868 - MikanOS
[1] https://www.amazon.co.jp/dp/B00IR1HYI0 - 30-days Homemade OS
[2] https://0xc0ffee.netlify.app/osdev/ - Fusion, an OS made in Nim
And of course I will document everything as I make more progress.
As for your case, I understand the need to avoid locks. In my case, the channel is implemented as a queue of messages, which is implicitly synchronized between tasks. Currently it's implemented using a blocking queue, since I want to put senders/receivers to sleep when the queue is full/empty, respectively. The API does support a no-wait option, but I'm not currently using it.
There will be a lot to write about once I'm past this point :)
I did bookmark this project a few months ago but couldn't spend time to understand more about it. I wasn't aware of documentation, which should now make it easy to start with. Thanks for putting a lot of work in documentation!