[HN Gopher] MINIX from Scratch
       ___________________________________________________________________
        
       MINIX from Scratch
        
       Author : elvis70
       Score  : 200 points
       Date   : 2023-02-23 15:20 UTC (7 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | hungryforcodes wrote:
       | I don't get it. Tannenbaum would normally keep it in a buildable
       | state -- he's basically the Linus of Minix no?
       | 
       | As an aside I enjoy the irony that we are trying to build Minix
       | on Linux systems many years after the debate...
        
         | wkat4242 wrote:
         | Tanenbaum retired and minix was more of an educational project.
         | Not really for production. It was a great way for students to
         | learn about Unix when Unix only ran on expensive computers.
         | Including the design of it (be aware that with the first unixes
         | Sysadmins would receive the code and regularly made changes!)
        
         | kybernetikos wrote:
         | > As an aside I enjoy the irony that we are trying to build
         | Minix on Linux systems many years after the debate...
         | 
         | To add another layer - as I understand it, the processors we
         | are mostly running those Linux systems on are secretly running
         | a minix based system for their management functions [1].
         | 
         | [1] https://www.networkworld.com/article/3236064/minix-the-
         | most-...
        
           | atleta wrote:
           | Interesting. But it seems that MINIX does not run _on_ the
           | (same) processor as we 're running Linux on (which would have
           | been pretty surprising) but there is a separate low power CPU
           | on the mother board that runs the management software under
           | MINIX.
           | 
           | Reference:
           | https://en.wikipedia.org/wiki/Intel_Management_Engine
        
             | kybernetikos wrote:
             | Yes, it looks like I was confusing it with the AMD
             | equivalent, which does have an ARM core literally in the
             | CPU silicon to run the management software (but looks like
             | it doesn't run minix).
        
           | taftster wrote:
           | This is a good link, appropriate for the conversation, thank
           | you for providing it!
           | 
           | Just to rant about this article though, I really dislike this
           | statement by the author:
           | 
           |  _> Why on this green Earth is there a web server in a hidden
           | part of my CPU? WHY?
           | 
           | > The only reason I can think of is if the makers of the CPU
           | wanted a way to serve up content via the internet without you
           | knowing about it._
           | 
           | That's absolutely not the use case here. Intel is not on some
           | secret conspiracy to collude with governments to serve
           | content from your computer.
           | 
           | The management system is a legitimately useful functionality
           | for the support teams of large corporations, public entities
           | (schools, local government), etc. enabling management of
           | their fleet of user devices. It's a very unforgiving and
           | thankless task to be able to support a worldwide workforce,
           | for example, or large non-computer savvy users.
           | 
           | Now, does the Intel Management Engine pose a security risk.
           | Absolutely! We tech folk should absolutely know about this
           | capability and be able to make decisions if this
           | functionality should be enabled for our fleet. Having it
           | default "on" without a way to sensibly turn it off broadly or
           | update it when necessary is a big issue. But this is nothing
           | more than Intel giving the majority of its user base
           | functionality that is desirable, not some deep laden
           | conspiracy.
           | 
           | I don't like the Intel Management Engine running on my
           | personal device. But I sure appreciate it for its intended
           | use case and audience.
        
             | nunobrito wrote:
             | That rant is merely your opinion and somewhat optimistic.
             | Reality is that you get an extra CPU running completely on
             | its own without code available nor clear path to disable
             | such "feature".
             | 
             | If it can serve data from your computer, it _will_ serve
             | data from your computer.
             | 
             | Not everyone across the globe is confortable with lack of
             | privacy on their own devices.
        
               | taftster wrote:
               | Agreed on your points. I particularly like, "If it can
               | serve data, it will serve data." Totally get that point
               | of view.
               | 
               | I fully wish that Intel would have gone with the "opt in"
               | approach. Either opt-in with choices in architecture, or
               | opt-in with the option disabled by default. It's the
               | "always there, you don't see it, you can't disable it"
               | thing that's the problem. Intel messed up here, for sure.
               | 
               | But the idea of the Intel Management Engine is sound and
               | extremely useful. And it's the visceral (possibly
               | unsubstantiated) attack against it in discourse that's
               | the thing I'm addressing.
               | 
               | I mean, truthfully, maybe the only way to change things
               | anymore is to be overly loud and exaggerate about issues,
               | basically black & white arguments without any middle
               | ground. Maybe social media has brought us to this point,
               | where we can't see issues as both positive and negative.
               | It kind of starts to sound like our politics, in this
               | way. So maybe the only thing that could possibly change
               | how the IME is configured or deployed is to be a huge
               | stinker about it and make large noise. Sad, but that's
               | probably the case.
        
       | [deleted]
        
       | justin66 wrote:
       | Nice. It is a pity that this is necessary, but a quick look at
       | the Minix online presence makes it seem as though it has been
       | largely abandoned. Interesting, since Minix is one of those
       | projects that is really everywhere. Still an important component
       | in lots of firmware.
        
         | wkat4242 wrote:
         | Yeah and most notably Intel management engine.
         | 
         | If it were GPL they'd have to give back their modifications to
         | the community..
        
           | codetrotter wrote:
           | If it were GPL they wouldn't have used it in the first place
           | for that. And instead they would have based it off of
           | something else, or written it from scratch.
        
         | wrycoder wrote:
         | Without MINIX and the GPL, the world might be vastly different:
         | 
         | https://news.ycombinator.com/item?id=34917014
        
       | jmorenoamor wrote:
       | I remember having to rewrite the file blocking primitives to
       | allow blocking only some sections of each file as a class
       | assignment in college.
       | 
       | It was fun, and I learned a lot about OSs in that class.
        
       | znpy wrote:
       | Is the book worth reading?
        
         | yazantapuz wrote:
         | Yes. It is a good introduction to some of the basics of OS
         | design and implementation. And imho it is nicely written.
        
       | hardware2win wrote:
       | How about creating an OS from scratch without bias from existing
       | designs?
        
         | JustSomeNobody wrote:
         | What kind of bias?
        
           | layer8 wrote:
           | There are design choices you probably wouldn't make this way
           | today for a new green-field OS, like the process forking
           | mechanism, the POSIX threading and file IO API, the whole TTY
           | architecture, and the file permissions model. These are all
           | aspects that are different on Windows, for example.
           | Similarly, starting with a stripped-down Windows, you
           | wouldn't end up with a Unix-like design.
        
           | IshKebab wrote:
           | Look at all the things that Plan9 and Fuchsia do differently.
        
         | layer8 wrote:
         | It's difficult to eliminate bias without also eliminating the
         | lessons learned by history.
        
         | kjs3 wrote:
         | Probably because if we're teaching people 'Operating Systems',
         | most people think 'operating systems and OS concepts we might
         | actually use in our daily lives'. "Creating an OS from scratch
         | without bias from existing designs" is for hobbies and PhDs,
         | and there are a number of them out there.
        
       | bogomipz wrote:
       | I was curious about the statement in the README:
       | 
       | >"Until now, I have not been able to find a MINIX 3 project that
       | allows you to compile the code that is referenced in the book
       | Operating Systems: Design and Implementation (3e) (v3.1.0)."
       | 
       | For such a well-known and longstanding project I was surprised to
       | read this. Are the sources available at https://git.minix3.org
       | just too old or is this more to do with the book?
        
         | maartenh wrote:
         | Well, Tanenbaum retired in 2014 [1], so the book probably won't
         | get updated anymore.
         | 
         | [1] http://www.few.vu.nl/~ast/afscheid/
        
         | funkytrousers wrote:
         | I tried with a group of friends about 2 years ago, and this
         | rings true with our experience. I think we did eventually get a
         | build working, but there were many build issues, and they were
         | different on different linux distros. Much documentation seemed
         | out of date, especially with respect to the migration to the
         | BSD toolchain (IIRC).
        
           | bogomipz wrote:
           | Interesting. I wonder if every university that uses the
           | textbook just maintains it's own repo then?
        
             | TedDoesntTalk wrote:
             | My class used the textbook, but we never built minix from
             | scratch or even used it in real-life. Still a lot to be
             | learned that way.
        
           | avinassh wrote:
           | If we put this on docker, that would avoid a similar
           | situation in future right
        
             | cxr wrote:
             | It doesn't fix the issue of code comments and other
             | documentation being out of date (read: wrong).
        
           | sitzkrieg wrote:
           | i had similar experience a few years ago, ended up playing
           | with xv6. not the same of course
        
           | cxr wrote:
           | From an 8 year old HN comment:
           | 
           | > _if someone thinks they 're going to be able to pick up the
           | latest edition of Operating Systems: Design and
           | Implementation in search of documentation for either MINIX-
           | the-project or MINIX-the-software, they will be sorely
           | disappointed. The fact that the book is now about a decade
           | out of date is one reason for the latter. There are a number
           | of reasons for the former._
           | 
           | <https://news.ycombinator.com/item?id=9894961>
        
       | matesz wrote:
       | Amazing to see that every file and directory name is short single
       | word with very few exceptions.
        
       | jdc0589 wrote:
       | oh man, this was part of my intro to operating systems
       | programming (not that I have a clue what I'm doing) in school 13
       | years ago. a month or two of "os" work in a simulated kernel on
       | the JVM, and then in the last 3 or 4 weeks the professor hit me
       | with "here's minix, play with some these changes for homework",
       | and then the final exam was "make these changes to the filesystem
       | module".
       | 
       | Worst I ever did in a CS class. I did not deserve whatever grade
       | he gave me, but I was the only person that stuck it out and
       | didn't drop the class.
        
         | lloydatkinson wrote:
         | Sometimes the disconnect between what is taught and what is
         | expected by lecturers in assignments is very big, don't feel
         | too bad!
         | 
         | It could be because they are coming at it from the "experts
         | bubble" (I'm sure someone will know the proper name) where they
         | can't conceive of the types of problems someone coming at it
         | with no experience will encounter.
         | 
         | Going from a tiny "hello world" OS you've made by following
         | instructions and notes to being dropped into a totally
         | different codebase that uses probably entirely different
         | patterns and conventions seems a little unfair. It's like
         | expecting someone who has played around with some graphics API
         | for drawing pixels to expecting them to make changes to the
         | DirectX shader compiler.
         | 
         | I had a similar experience - a totally new professor gave us a
         | about 5 lectures on parsers, compilers, AST's, BNF etc, and
         | then just expected us to design a whole language that would be
         | compiled to C for the assignment, using classic tools like yacc
         | etc. For reference, the average programming ability of the
         | students in the class was "What's a switch statement?".
         | 
         | Absolutely everybody failed to achieve anything, and the only
         | reason I even passed it was because I took an example language
         | the professor provided and reviewed it and stated how I would
         | liked the language to work instead.
         | 
         | It's all a bit absurd.
        
           | jdc0589 wrote:
           | ironically, the same professor taught a compilers class and
           | did a FANTASTIC job with it.
           | 
           | We did pascal (probably a subset of the language, cant
           | remember) and then c--. we did an interpreter + runtime for
           | one, and compilation to some sort of bytecode for the other.
           | dont remember which was which.
        
             | lloydatkinson wrote:
             | The same professor?
        
               | jdc0589 wrote:
               | yep
        
           | kif wrote:
           | > It could be because they are coming at it from the "experts
           | bubble"
           | 
           | I believe you mean the curse of knowledge [0].
           | 
           | [0]: https://en.wikipedia.org/wiki/Curse_of_knowledge
        
             | pxc wrote:
             | I've had a professor tell the class, in a relatively rare
             | and small course:
             | 
             | > I've been doing this so long that I can't remember which
             | things are easy and hard to pick up for the first time, so
             | you all will have to tell me-- if you don't ask questions
             | after each reading, I won't know what to reinforce and you
             | will be lost.
             | 
             | I think that's how it goes for classes that are not
             | frequently taught or haven't been taught before, in almost
             | any subject area.
        
       | snvzz wrote:
       | The one thing MINIX really needs is a maintainer.
       | 
       | The 3.3.0-rc8 or whatever version has been sitting there for
       | several years, despite all blockers already fixed. Just because
       | there's nobody at the helm to push the release out.
       | 
       | There's also significant unmerged work that's just waiting for
       | someone to merge it.
        
         | roywashere wrote:
         | I noticed the same. During lockdown I felt bored and thought
         | about porting my fav software to minix only to find out that
         | minix is really dead nowadays
        
         | guestbest wrote:
         | I think TempleOS is a better unmaintained operating system.
        
         | boricj wrote:
         | It's not just the lack of active maintainers. MINIX 3 is a
         | technological dead-end on multiple fronts and the various
         | grants and funding sources have dried up.
         | 
         | The micro-kernel is mostly unchanged from its previous
         | incarnations. It can be described as an hollowed-out Unix-like
         | kernel design from the 80's, to the point where a fair number
         | of its syscalls are direct equivalent to Unix ones. Basic
         | features taken for granted nowadays, like 64-bit support, SMP
         | or kernel threads are missing. Its code is especially old and
         | difficult to work with.
         | 
         | The driver layer works best with a computer from 20 years ago.
         | There's no support for USB (on x86), NVMe, display controllers,
         | UEFI and so on. I don't think that booting on modern hardware
         | would be even possible at this point without some major
         | overhaul.
         | 
         | The service layer is similarly outdated. The most modern
         | filesystem supported is ext2 and it wasn't very stable from
         | what I remember. The native MINIX 3 file-system implementation
         | is solid, but its design is very similar to the System V file
         | system from the early 80's. The most advanced isolation
         | mechanism available is chroot and there's no support for
         | running multiple, isolated userspace instances, which is a
         | shame for a micro-kernel, service-based operating system.
         | 
         | Replacing the outdated MINIX userland with a source port of
         | NetBSD's userland a decade ago was a colossal mistake in
         | hindsight. The NetBSD source tree required a lot of
         | modifications to make this work and back-porting newer versions
         | of NetBSD's source tree is extremely difficult. Instead, a
         | NetBSD syscall translation layer to achieve binary
         | compatibility would've probably been a far more maintainable
         | solution. Additionally, pkgsrc support wouldn't be a problem
         | either.
         | 
         | Finally, I'm pretty sure no one used it as a daily driver back
         | in the 2010's. While it was reasonably functional through SSH
         | inside a VM, trying to use it on real hardware was an exercise
         | in frustration because of all the sharp edges.
         | 
         | Don't get me wrong, MINIX 3 has extremely cool features like
         | the ability to transparently updating system services on-the-
         | fly or extreme resiliency against device driver crashes. The
         | presentation talks done by Andrew Tanenbaum [1] are in my
         | opinion still extremely good to this day and a fair number of
         | the research papers on the MINIX 3 are worth the read. I'm not
         | trying to discourage anyone from trying it out or stepping up
         | as a maintainer, but there's a reason why it became
         | unmaintained.
         | 
         | [1] https://www.youtube.com/watch?v=MG29rUtvNXg (there are
         | multiple versions of it done over the years)
         | 
         | Source: I'm a former contributor.
        
       | hulitu wrote:
       | > MINIX from Scratch
       | 
       | Can you install gcc and X ?
        
         | bodyfour wrote:
         | X: yes, minix has X11R7 binaries:
         | https://wiki.minix3.org/doku.php?id=usersguide:introductiont...
         | 
         | I don't think I've run an X server on it ever, but I can verify
         | you can at least get it to pop up xterm's on a remote machine.
         | 
         | gcc: I don't think any recent gcc's work, but the latest minix
         | (3.4.0rc6) does have clang-3.6 as /usr/bin/cc
        
       | darig wrote:
       | [dead]
        
       | revskill wrote:
       | Do we have virtual memory API at the network level ? The goal is
       | i can use Redis as my real memory.
        
       | smasher164 wrote:
       | I think xv6 is a much more palatable intro to operating systems
       | than minux. It's a tiny codebase, with an annotated guide, and a
       | book explaining its core ideas and implementation in a very
       | direct way.
        
         | rashkov wrote:
         | I've been going through the xv6 book and source code over the
         | past week, and it has been a delight. It's ready to compile,
         | the source code is very easy to read and very small with the
         | biggest files weighing in at 500 lines. The book is written
         | really well. Just delighted to be learning this material in
         | such a nice way.
        
         | Koshkin wrote:
         | I agree, and Minix has been (advertized as) production-quality
         | for a while now.
        
         | Tepix wrote:
         | Impossible, it's not even written in Rust! /s
        
       | dmazin wrote:
       | I promise that this is a good-faith question: is MINIX still the
       | best OS teaching tool? Personally, I enjoyed the lectures of
       | https://rust-class.org/, though the Rust code itself may be a
       | little outdated (it's from 2014).
        
         | adastra22 wrote:
         | Yes. The MINIX book is still the most accessible text, and
         | MINIX is small enough to be comprehended by a student in a
         | semester.
        
           | yjftsjthsd-h wrote:
           | Any idea how it compares to xv6?
        
             | Koshkin wrote:
             | xv6 is a toy, compared.
        
         | Decabytes wrote:
         | I think that they answer that here^1 But the short answer is
         | the author seems to believe so.
         | 
         | 1. https://github.com/o-oconnell/minixfromscratch#why-minix
        
         | kjs3 wrote:
         | 'Best' is subjective, of course. If you think a pretty well
         | written, accessible textbook coupled with a working, non-
         | trivial but understandable codebase to examine is a good way to
         | learn things, then "Operating Systems: Design and
         | Implementation" and Minix is a pretty good choice. YMMV.
        
         | efficax wrote:
         | the foundational aspects of actually-used operating systems
         | have been basically the same for 25 years or so. Lots of
         | improvements, sure, but the basic ideas remain the same. MINIX3
         | is even kind of advanced compared to, say, Linux, since it uses
         | a microkernel architecture. So it's as fine place to start as
         | any.
        
           | wkat4242 wrote:
           | Minix always used a microkernel even in early versions. It
           | was the source of a big flamewar between Linus and Tanenbaum
           | back in the day :)
           | 
           | Microkernels are not really modern as such. Just different.
        
           | TedDoesntTalk wrote:
           | > basically the same for 25 years or so
           | 
           | Minix is a lot older than 25 years. Your point stands, but
           | you need to increase the age. Minix and Tannenbaum's textbook
           | was part of my operating systems class in undergrad CS. I
           | think I took that class in 1989 or 1990.
        
         | j7f3 wrote:
         | Has it ever been a consensus best? Today xv6 is likely the most
         | popular choice and before xv6 there was nachos and its more
         | recent offshoots.
        
       ___________________________________________________________________
       (page generated 2023-02-23 23:00 UTC)