Hi, author here! I've just finished writing the pre-emptive multitasking [0](only round robbin though, nothing fancy).
I'm currently writing an ATA driver [1], the idea is to implement ext2.
I used to do this in Rust but I switched to zig for maintainability and readability over Rust. It seems that with `comptime` I'm able to make a lot of things optimal.
Overall I have to say kernel programming is _hard_ but very rewarding when it finally works, it's really demystifying computers for me!
> I used to do this in Rust but I switched to zig for maintainability and readability over Rust.
Can you expand on this ? I'm asking out of curiosity because I want to learn a "system" programming language (for whatever definition there is to this term). So far I briefly tried Rust and Nim and found the former more difficult to read. I know nothing about Zig, how would you place it between these two ?
Author, if you decide to build more of this kernel any thoughts on providing live screencasts of the implementation like Andrew Kelly (Zig) and Andreas Kling (SerenityOS) on Youtube and/or Twitch. I never realized how effective it is for me to watch others go through the mental process of coding/debugging.
Great work! I'm just behind you working on my own alternate language x86 kernel in Ada: https://github.com/ajxs/cxos
Admittedly I don't know much about Zig, but it's good to see people investigating languages other than C. I'm still not convinced of Rust's merits in this area, we'll see how this develops with time.
Zig is so much better than Rust for these sorts of tasks. Readable and maintainable. The Rust astroturf-brigade tries hard to make it fit any situation. I'm glad you have provided a substantial concrete counterexample.
I tried to do this with Zig about 13 months ago. It was not where it needed to be at that time; the biggest impediments were its rudimentary handling of C pointers to one vs pointers to many (which has long since been fixed), and its meta programming issues (lack of a macro language or pre-processor) that made OS development tedious. I have not revisited it as much as I would have liked simply because I chose to step back a bit on implementation and focus on theory.
I'm pulling for Andrew. He busts his rear-end, livestreams, and is generally a good dude. Zig has a TON of potential.
I've been waiting for something that looks like a firm step forward in the domain of games programming and has ideals which align with the domain. I'm extremely excited for zig and have been messing around with getting a smallish simulation running with SDL on Windows.
At work in C++ I've switched from working on fairly isolated types, where my changes had fast recompile times to lower level changes which cause a good chunk of the engine to recompile. 10 minute compile times, with a lot of tech trying to get that time down as much as possible, are a huge killer to productivity and I can feel myself getting much less done than I was before.
Zig tossed away a lot of the constructs that make C++ slower to compile. I haven't had a chance to see its timings on large projects, but stuff like Jai compiling 90k LoC full commercial game project live on a laptop in 1.4 seconds (which caused Jonathan Blow to say "what? That's weirdly slower than it should be...") gives me hope that Zig is similar.
I really wish Zig picks up and goes mainstream. I also wish it gets a little (not too much) of higher level features. Something in line of simple OOP.
I would even start using it now for some smaller projects that are not vital but I was stalled on Zig not being able to compile some C (it claims to do that and it does but not in my cases). Sure I could do import but would rather prefer for Zig feature to work
I'd like to state that after significant time and effort with Rust, I also think it's too complex for what it's protecting us from. Zero-cost indeed does not refer to the cognitive price. It's better than C++ though, in every way except popularity.
I'd rather read that first to get my bearings, as opposed to opening up a folder full of gibberish code.
Usually a well written design document explains the high level constructs of the project. Then some mid-level documents ties in the design document, with the implementation code.
This makes the project more intelligible, and allows for a layman to jump in, and follow along.
migration from 0.4 to 0.5 was ok.
AFAICT there the big change for 0.6 syntax wise is the drop or varargs in favour of tuples. I'll take some time to do the switch when 0.6 hits but I'm confident it won't take long because of how concise the language is.
[+] [-] jackhalford|6 years ago|reply
I'm currently writing an ATA driver [1], the idea is to implement ext2.
I used to do this in Rust but I switched to zig for maintainability and readability over Rust. It seems that with `comptime` I'm able to make a lot of things optimal.
Overall I have to say kernel programming is _hard_ but very rewarding when it finally works, it's really demystifying computers for me!
[0] https://wiki.osdev.org/Brendan%27s_Multi-tasking_Tutorial
[1] https://wiki.osdev.org/IDE
[+] [-] guggle|6 years ago|reply
Can you expand on this ? I'm asking out of curiosity because I want to learn a "system" programming language (for whatever definition there is to this term). So far I briefly tried Rust and Nim and found the former more difficult to read. I know nothing about Zig, how would you place it between these two ?
[+] [-] joshbaptiste|6 years ago|reply
[+] [-] ajxs|6 years ago|reply
Admittedly I don't know much about Zig, but it's good to see people investigating languages other than C. I'm still not convinced of Rust's merits in this area, we'll see how this develops with time.
[+] [-] fortran77|6 years ago|reply
[+] [-] rehemiau|6 years ago|reply
[+] [-] bambataa|6 years ago|reply
[+] [-] vkaku|6 years ago|reply
[+] [-] ffwff|6 years ago|reply
[+] [-] anon767|6 years ago|reply
[+] [-] teleforce|6 years ago|reply
[+] [-] steeve|6 years ago|reply
[+] [-] knebulae|6 years ago|reply
I'm pulling for Andrew. He busts his rear-end, livestreams, and is generally a good dude. Zig has a TON of potential.
[+] [-] Bekwnn|6 years ago|reply
At work in C++ I've switched from working on fairly isolated types, where my changes had fast recompile times to lower level changes which cause a good chunk of the engine to recompile. 10 minute compile times, with a lot of tech trying to get that time down as much as possible, are a huge killer to productivity and I can feel myself getting much less done than I was before.
Zig tossed away a lot of the constructs that make C++ slower to compile. I haven't had a chance to see its timings on large projects, but stuff like Jai compiling 90k LoC full commercial game project live on a laptop in 1.4 seconds (which caused Jonathan Blow to say "what? That's weirdly slower than it should be...") gives me hope that Zig is similar.
[+] [-] vips7L|6 years ago|reply
[+] [-] FpUser|6 years ago|reply
I would even start using it now for some smaller projects that are not vital but I was stalled on Zig not being able to compile some C (it claims to do that and it does but not in my cases). Sure I could do import but would rather prefer for Zig feature to work
[+] [-] aganame|6 years ago|reply
I'd like to state that after significant time and effort with Rust, I also think it's too complex for what it's protecting us from. Zero-cost indeed does not refer to the cognitive price. It's better than C++ though, in every way except popularity.
[+] [-] rumanator|6 years ago|reply
[+] [-] blackrock|6 years ago|reply
I'd rather read that first to get my bearings, as opposed to opening up a folder full of gibberish code.
Usually a well written design document explains the high level constructs of the project. Then some mid-level documents ties in the design document, with the implementation code.
This makes the project more intelligible, and allows for a layman to jump in, and follow along.
[+] [-] kburman|6 years ago|reply
[+] [-] archsurface|6 years ago|reply
[+] [-] jackhalford|6 years ago|reply
[+] [-] maruko|6 years ago|reply
[deleted]
[+] [-] saluuu|6 years ago|reply
[deleted]