Fiwix: Small Unix-Like Kernel

79 points by coolcoder613 5 months ago | 40 comments
  • PeterWhittaker 5 months ago
    Interesting. While I do appreciate that it runs on i386, I have to question its being aimed at students - or at least students of anything other than the history of computing. i386 implies BIOS, AFAIK, and requires pre-x86_64 assembler, which is only partially transferable to modern CPUs.

    Oh, for sure, one would learn an awful lot working with those technologies, but as soon as one wished to work on more modern systems, one would have to forgot all of the former and all the ugly of the latter.

    This isn't really a criticism, more an expression of puzzlement. Normally, I'm a pretty good contrarian, but I don't get it.

    True, there was this Finn who did this some time ago and it worked out pretty well, but I still don't get why anyone would start with i386 and BIOS.

    • bitwize 5 months ago
      You can write a fully 32-bit kernel, delegate entering protected mode and using the BIOS to load from disk to the bootloader, and tell your students "this bit won't be on the exam".
      • MisterTea 5 months ago
        > i386 implies BIOS, AFAIK, and requires pre-x86_64 assembler, which is only partially transferable to modern CPUs.

        Nothing wrong with this IMO. You dont want a 64-bit Arm/x86 hegemony. If the OS is designed properly you won't notice the platform underneath which means you have the right abstractions. That is an important challenge for students - decoupling platform dependency from the OS architecture. It also teaches them older tech which gives them a history lesson so they understand how and why we got here.

        • 6SixTy 5 months ago
          If a 64 bit ARM/x86 hegemony is a big concern, then why not drop i386 and go with RISC-V? There's both a 32 and 64 bit variants, and a free emulator. Also, it's more useful academically and practically.
          • MisterTea 5 months ago
            Well Risc-v isn't as established as 32bit x86 which has a wide breadth of information available. There are also plenty of 32 bit x86 machines still around so testing your OS on real hardware and watching your programs work is quite a treat.
      • pabs3 5 months ago
        In use by the Bootstrappable Builds folks to be able to build the Linux kernel before having a Linux or other kernel binary, since Linux requires compilers that are only bootstrapped later in the process.

        https://bootstrappable.org/https://lwn.net/Articles/983340/

        • bitwize 5 months ago
          Just a hobby, not big and professional like GNU. I love it.
          • Rochus 5 months ago
            What's the difference to e.g. xv6?

            There are already so many Unix like operating systems of all sizes written in C (e.g. Minix, xv6, BSD, Darwin, Hurd, Lemon, MentOS, SanOS). If I were to go to such an effort, I would try another language, or even my own (like e.g. Bunnix written in Hare). It is meanwhile more than clear that it can be done in C. But C is not really a good programming language (weird syntax, incomplete type checking, many specification gaps, etc.), so it would actually be more interesting to explore the suitability of other languages for such a task.

            • BirAdam 5 months ago
              C has been the standard system language almost since the time of its creation. Teaching that standard is valuable even if we’re in the midst of a change.

              As for why, a system designed to be pedantic will necessarily be different from one intending to be production ready.

              Why i386 and BIOS? It is simple enough for the purpose of teaching. Inundating a student with modern x86-64, UEFI (where most implementations do not meet standards), and such is not a great idea. People just get overwhelmed and shut down. It may be worthwhile to start with something simpler honestly, like DOS and 8088, or even CP/M and 8080. Working one up through time exposes the individual to simpler things and then progressively more complex things. It is useful.

              As a side benefit, teaching people about these older things instructs them on how and why things came to be the way they are which may help create better entrepreneurs.

              • Rochus 5 months ago
                > even if we’re in the midst of a change.

                What change do you refer to?

                Concerning C: C has obviously proven itself in countless system and embedded projects of all sizes. Nevertheless, C essentially represents the state of knowledge of the early seventies. Projects like the one discussed would be a good opportunity to test newer languages for their suitability for operating system and embedded development, without the pressure of a commercial project.

                > Why i386 and BIOS? It is simple enough for the purpose of teaching.

                Agree; that's also one of the reasons operating systems like xv6 dedicated for teaching do so; I'm therefore interested in how Fiwix positions itself in relation to xv6.

                • pjmlp 5 months ago
                  C was hardly seen as systems language in 8 and 16 bit home computers, just one more to chose from, as most compute intensive stuff was actually still written in Assembly.
                  • BirAdam 5 months ago
                    Microcomputers weren't the dominant computer type in the 70s and very early 80s.
                • sjsdaiuasgdia 5 months ago
                  When you write one, you can make those choices however you like.

                  This target was sufficiently interesting to the people who pursued it. It doesn't have to meet your arbitrary standards.

                • Paul-Craft 5 months ago
                  This one is just a hobby (won't be big and professional like gnu), after all. ;-)
                • pabs3 5 months ago
                  IIRC Fiwix has syscalls compatible with Linux, which could be useful in some cases.
                  • Rochus 5 months ago
                    Thanks for the first useful answer so far. Does this mean that Fiwix would allow ELF binaries compiled for Linux to be executed natively in a Fiwix system without emulation? Have you tried this?
                    • pabs3 5 months ago
                      I think that is correct, depending on how modern the syscalls used are I guess. I expect it doesn't implement a lot of them. I haven't tried it though.
                  • 5 months ago
                    • dkenyser 5 months ago
                      > since it serves also for educational purposes, the kernel code is kept as simple as possible for the benefit of students and OS enthusiasts
                      • Rochus 5 months ago
                        Same as e.g. xv6.