Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Tuesday December 30, @03:23PM   Printer-friendly
from the if-only-rust-had-been-invented dept.

The Register reports that UNIX V4, the first with the kernel written in C, has been recovered, restored and run.

The source code and binaries were recovered from a 1970s-vintage nine-track tape and posted to the Internet Archive where it can be downloaded.

It's very small: it contains around 55,000 lines of code, of which about 25,000 lines are in C, with under 1,000 lines of comments. But then, the late Dennis M. Ritchie and co-creator Ken Thompson were very definitely Real Programmers, and as is recorded in ancient wisdom: "Real Programmers don't need comments – the code is obvious."

For those who don't already know:

UNIX started out as a quick hack by two geniuses in their spare time, so that they could use a spare computer – an extremely rare thing in the 1960s – to run a simulation game flying the player around a 2D of the Solar System that one of them had written. It was called Space Travel.


Original Submission

This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 5, Interesting) by VLM on Tuesday December 30, @04:46PM (9 children)

    by VLM (445) Subscriber Badge on Tuesday December 30, @04:46PM (#1428267)

    it contains around 55,000 lines of code

    Yeah I haven't seen it so I don't know if I'm comparing apples to oranges. Does that include utils etc? I donno.

    If you want a comparison, try the Minix 1.0 kernel-only source code.

    I'm currently sitting in front of a very well worn second hand gray market illegal import first international edition copy of Operating Systems Design and Implementation by Tanenbaum from 1987. Legendarily appendix E the complete kernel source code listing is 12K lines of code. On my copy it starts on page 433 and ends on page 686. So thats 253 pages and back in the day you'd print maybe 60 lines on a dot matrix printer so thats 15K LoC rough estimate.

    Some cultural context was in the 80s I'd get computer magazines like 80-Micro and it was considered normal to type in 2, 3, 4 pages of source code then debug it then play frogger on your computer. Its a bit extreme to consider typing in all 15K lines of minix to get a kernel without any OS support (so it can't even boot). However, much as I learned a lot about debugging using home computer magazines in the early/mid 80s, by the late 80s I could learn a lot from my copy of the minix kernel.

    Some more cultural context is it was "normal" to sell books of disassembled roms back in the 80s. "Journey to the center of the ROM" had an entire series back in the TRS-80 days. I learned A LOT about programming by reading disassembled and commented code. It was a bit of an accomplishment when I finally understood microsoft basic's crazy tokenizer. Oh thats how that works that's what its trying to do. Oh OK then.

    I spent a fair number of hours reading this book back in the day. Even back then, plenty of "ya know in my infinite spare time I'd like to ..." followed by a long list of stuff I never did with minix.

    IIRC Tanenbaum was extremely unhappy that people (like me, LOL) were downloading bootable minix distros "for free" from BBSes, etc. Thats where I got mine. IIRC I ran it on a Tandy 286 (T series? TL?). I enjoyed reading the source code in the book while messing with it. Eventually when I obtained a 386 I moved on to Linux in the fall of '93 again downloaded a SLS distro worth of floppy images from a local BBS. I had to buy two boxes of floppies and one flip top disk storage box, IIRC

    Two interesting points: Tanenbaum always called it "his" minix but if you look at the source code in the book, like I'm reading ink on paper while typing this now in 2025, its clearly "Copyright (C) 1987 by Prentice-Hall, Inc" NOT Tanenbaum. I'm sure there's a fascinating story about that.

    Another interesting point is I know this book went thru "a bunch" of editions I have no idea if all the editions have 250+ pages of source code. But I can verify the first edition certainly does.

    The book is pretty good and holds up in 2025. Starts out a little trivial but before page 100 its butting up against "the dining philosopher's problem" of IPC deadlocks, pretty interesting stuff to be reading around 1990.

    So anyway reminiscing over, just saying as a point of comparison that the minix kernel 1.0 was about 12K LoC or about 250 printed pages.

    • (Score: 1, Interesting) by Anonymous Coward on Tuesday December 30, @05:31PM

      by Anonymous Coward on Tuesday December 30, @05:31PM (#1428272)

      There has been an ongoing effort to try to archive every Minix release.
      I don't know how far it has gotten, but not every version seems to
      have been saved.

      There was also the thrash over the Amsterdam Compiler Kit not
      originally being released.

    • (Score: 3, Interesting) by RamiK on Tuesday December 30, @09:15PM (6 children)

      by RamiK (1813) on Tuesday December 30, @09:15PM (#1428293)

      Two interesting points: Tanenbaum always called it "his" minix but if you look at the source code in the book, like I'm reading ink on paper while typing this now in 2025, its clearly "Copyright (C) 1987 by Prentice-Hall, Inc" NOT Tanenbaum. I'm sure there's a fascinating story about that.

      Copyright is quite literally the transfer of the right to make copies to a publisher in exchange for money. That is, if Tanenbaum hasn't transfer that right to them, they wouldn't be able to print it.

      --
      compiling...
      • (Score: 3, Informative) by Bentonite on Wednesday December 31, @04:38AM (5 children)

        by Bentonite (56146) on Wednesday December 31, @04:38AM (#1428321)

        Completely false.

        Copyright in the USA can only legally be and in all countries can only legitimately be a temporary monopoly to encourage authors to publish more works (as more works are in the public interest).

        Too bad copyright laws have been twisted and corrupted to primarily attempt to maximize (a handful of) business profits and encourage authors to publish one work and milk it forever (rather that publishing a work, then once it has run its course, moving on to the next work).

        Such depraved actions have been legitimatized with the liberal application of corporate propaganda that people actually believe and the result is whenever it is mentioned that copyright can only legitimately serve the public interest, the typical response is; "Stuff the public interest - no matter what I do, the government should always force the public to give me money".

        A copyright holder can authorize a publisher to print copies on their behalf as part of a business agreement without handing over the copyright - as the copyright holder can authorize anything that requires copyright permission.

        Although, many publishers did and still will refuse to publish works unless the author signs a contract that transfers the copyright to them (to best screw over the author).

        One sinister goal of such requirement is to ensure the author cannot legally distribute their own work even when it's out of print (but as a 100% unfair contract like that may be ruled invalid by a court, a more recent technique is to make the contract 99% unfair by stating in the contract that the copyright is transferred back once the work is out of print).

        Of course the publisher proceeds to ensure that the ebook version continues to be available on the publishers website, to ensure the book is never "out of print", despite the book being out of print.

        Unless the contract Tanenbaum signed stated that he had permission to distribute and modify the work, or parts of it as he liked, or that he would become the copyright holder again on x (and x as occurred), it could be that it wasn't "his MINIX", as he didn't have permission to distribute and/or modify it anymore.

        • (Score: 2) by RamiK on Wednesday December 31, @02:42PM (4 children)

          by RamiK (1813) on Wednesday December 31, @02:42PM (#1428351)

          A copyright holder can authorize a publisher to print copies on their behalf as part of a business agreement without handing over the copyright - as the copyright holder can authorize anything that requires copyright permission.

          Transfer can be time limited, perpetual, exclusive to one publisher or open to other publishers per the contract's terms. However, the right to make copies (copyright) must be handed over at least while printing or copies can't be made.

          There's various clauses for reprints, corrections, editions, compensations, warranties, deadlines and so on... But it all comes down to you having the only right to make copies and having to transfer that right, by contract, to a publisher for them to be able to print and/or distribute it.

          Btw, the transfer of money is just contract law's "bargained-for exchange" where you can't give your rights away without compensation in some form. Like, attribution or share-alike is a form of compensation but even dismissal of warranty can be understood as sufficient. But, either way, rights must be exchanged for something a court can value or the contract will be void.

          Nothing about this is free vs. proprietary. It's literally what copyrights are and nothing more.

          --
          compiling...
          • (Score: 2) by Bentonite on Thursday January 01, @04:27AM (3 children)

            by Bentonite (56146) on Thursday January 01, @04:27AM (#1428398)

            >However, the right to make copies (copyright) must be handed over at least while printing or copies can't be made.
            Prove it - link to the relevant part of copyright law in the USA that says that.

            If you go to any non-publisher cartel commercial book printer and provide them a copy of your book and state you are the copyright holder of the book and you want them to print it, they'll print it - as the copyright holder's authorization is all they need.

            >But it all comes down to you having the only right to make copies and having to transfer that right, by contract, to a publisher for them to be able to print and/or distribute it.
            There is no legal requirement to need to go to a publisher to have a book printed.

            Please link to the relevant law that states that you need to go to a publisher and sign a contract to have a book printed (it's only if you go to a publisher that the publisher needs authorization to print the book - but generally the publisher will request transfer of copyright instead).

            >There's various clauses for reprints, corrections, editions, compensations, warranties, deadlines and so on.
            Link to those please.

            I suspect that those only relate to if a copyright holder is a sucker and goes to a publisher.

            >It's literally what copyrights are and nothing more.
            How copyright restricts copying is not a natural right - there's rather a natural right to make copies (as all of nature is literally about making copies) - but of course there's copyright, which is a governmental monopoly that enforces the brain damage of disallowing making copies.

            • (Score: 2) by RamiK on Thursday January 01, @12:35PM (2 children)

              by RamiK (1813) on Thursday January 01, @12:35PM (#1428422)

              Prove it - link to the relevant part of copyright law in the USA that says that.

              Sure:

              Subject to sections 107 through 122, the owner of copyright under this title has the exclusive rights to do and to authorize any of the following:
              (1) to reproduce the copyrighted work in copies or phonorecords;
              (2) to prepare derivative works based upon the copyrighted work;
              (3) to distribute copies or phonorecords of the copyrighted work to the public by sale or other transfer of ownership, or by rental, lease, or lending;
              (4) in the case of literary, musical, dramatic, and choreographic works, pantomimes, and motion pictures and other audiovisual works, to perform the copyrighted work publicly;
              (5) in the case of literary, musical, dramatic, and choreographic works, pantomimes, and pictorial, graphic, or sculptural works, including the individual images of a motion picture or other audiovisual work, to display the copyrighted work publicly; and
              (6) in the case of sound recordings, to perform the copyrighted work publicly by means of a digital audio transmission.

              ( 17 U.S. Code § 106 - Exclusive rights in copyrighted works ) [cornell.edu]

              There's a more general review of the codes here: https://www.law.cornell.edu/uscode/text/17/106 [cornell.edu]

              Again, copyrights are the exclusive right to make copies so you have to transfer that right to the press for them to be able to make copies. The terms are negotiable contractually of course... But it is what it is.

              --
              compiling...
              • (Score: 2) by Bentonite on Friday January 02, @04:25AM (1 child)

                by Bentonite (56146) on Friday January 02, @04:25AM (#1428476)

                You just proved my point that

                so you have to transfer that right to the press for them to be able to make copies.

                is false;

                the owner of copyright under this title has the exclusive rights to do ****and to authorize**** any of the following:

                Despite the corruption of the law, the holder of the copyright can authorize anyone to

                (1) to reproduce the copyrighted work in copies or phonorecords;

                without needing to transfer their copyright.

                • (Score: 2) by RamiK on Friday January 02, @09:14PM

                  by RamiK (1813) on Friday January 02, @09:14PM (#1428529)

                  Authorizing print is licensing which is a temporary / limited transfer of copyrights.

                  I think you're confusing two thing:

                  1. Ownership isn't copyrights.

                  2. Authors can, and often do, just open their own publishing companies if they so inclined. e.g. Mark Rippetoe's Starting Strength books are published under his own "The Aasgaard Company" company: https://aasgaardco.com/about/ [aasgaardco.com]

                  It's simply a matter of tax codes that tell you to fill out some forms and pay ~$300 registration fee to incorporate and do the copying under the company's name instead of some ad-hoc self-employed contractor hat.

                  Academic authors similarly often negotiate less exclusive publishing terms where they could still publish at least their own unedited and typeset copies in conjunction with the journal. They then go on and upload the files to their personal pages, github accounts or whatever so peers without academic access to the paper can still read them. It's very common in math and physics.

                  Musicians can do similarly by opening their own micro-labels for digital publishing at virtually not cost.

                  Look, I honestly don't under what rock you need to live to think monopolies and cartel control anything to do with copyrights in the US. Amazon... Lulu... Barnes & Noble... Bandcamp... They all gladly license your work as self-publishing and put it on their shelves. Only place monopolies and cartels enter into things here is the marketing and distribution in how advertising networks operate. But copyrights or ownership simply doesn't play into this since the likes of YouTube or Spotify aren't asking you for exclusive terms in any shape or form.

                  --
                  compiling...
    • (Score: 5, Informative) by Zoot on Wednesday December 31, @07:03AM

      by Zoot (679) on Wednesday December 31, @07:03AM (#1428326)

      I'm pretty sure 55KLOC covers the Kernel and ALL the UNIX commands and utilities for which source code is provided (it's not provided for things like the /usr/games programs).

      It's really amazingly minimal. There's only one shell, 'sh' which does one thing which is to run programs, with I/O redirection and piping. There's no environment, so no ENV vars, no PATH, etc. It tries to run the first thing on the command line. If that fails, it prepends /bin and if that fails it tries /usr/bin. That's it, no option to change it.

      Many programs are a page or two of C code. It's SUPER easy to read and understand this stuff (even if there are basically no comments). It's actually kind of refreshing.

      It is very similar in scope to early Minix versions.

      We figured out how to reconfigure the Kernel which comes without much of anything configured to the point that 'ps' won't work because there's no 'mem' driver enabled in the kernel and no /dev/mem. The distribution is thus a little insufficient out of the box, but you can get it all working and all the source is there to figure things out.

      They seem to have built distribution tapes off their R&D system. The /unix kernel was the one built by the distribution process, not the one the machine was running, and when you reconfigure it, the kernel is re-linked from a couple of ar .a libraries. I suspect the actual kernel source in /usr/sys/ken and /usr/sys/dmr does not exactly match what's in the libraries but in fact reflects the state of their development at the time the distribution tape was made. For example, there's an in-development driver for a Diva disk subsystem (inexpensive alternative to the DEC rp03) which was either done as a special or was just an internal experiment and in any case never made it into a real version.

      Anyhow, it's a lot of fun to play around with and hack on. About the first thing I did was to add 'cd' as an alternative to 'chdir' in sh because it was driving me insane lol.

      You can get it running in SIMH in just a minute or two using the files at http://squoze.net/UNIX/v4/ [squoze.net]

  • (Score: 4, Insightful) by JoeMerchant on Tuesday December 30, @05:30PM (10 children)

    by JoeMerchant (3937) on Tuesday December 30, @05:30PM (#1428271)

    >it contains around 55,000 lines of code, of which about 25,000 lines are in C, with under 1,000 lines of comments. But then, the late Dennis M. Ritchie and co-creator Ken Thompson were very definitely Real Programmers, and as is recorded in ancient wisdom: "Real Programmers don't need comments – the code is obvious."

    When the whole OS is 55KLOC, the code certainly can be obvious. The Lord of the Rings trilogy is roughly 300K words, 5-6 words per line of code? It takes a couple of readings to get the deeper meanings, but interested readers _can_ keep it all in mental context.

    As a comparison: "The word count for the Perry Rhodan universe is immense, with the main series alone estimated at over 90 million words from roughly 3,100 issues, and the total universe (including spin-offs like Atlan, Neo, etc.) reaching well over 100 million words across thousands of publications, making it one of the longest-running sci-fi sagas ever." They've been at that, continuously extending the story-base, since 1961.

    Windows 11? Estimated over 50 million lines of code.

    Debian 12? 1.34 Billion lines of code. (which, of course, includes all kinds of applications the Windows 11 core OS isn't even attempting to implement).

    --
    🌻🌻🌻🌻 [google.com]
    • (Score: 0) by Anonymous Coward on Tuesday December 30, @05:36PM (2 children)

      by Anonymous Coward on Tuesday December 30, @05:36PM (#1428273)

      "When the whole OS is 55KLOC, the code certainly can be obvious."

      Today, I doubt any one person could understand all of the bloat in
      a web browser.

      • (Score: 4, Touché) by JoeMerchant on Tuesday December 30, @07:22PM (1 child)

        by JoeMerchant (3937) on Tuesday December 30, @07:22PM (#1428281)

        a modern web browser

        is more OS than any OS that existed before the year 2000.

        --
        🌻🌻🌻🌻 [google.com]
        • (Score: 3, Interesting) by hendrikboom on Wednesday December 31, @03:16AM

          by hendrikboom (1125) on Wednesday December 31, @03:16AM (#1428314) Homepage Journal

          I wonder if either Servo or Ladybird are going to get us to simple, comprehensible browsers again.
          Though I doubt we'll ever get them to run on a 48K PDP-11. The first Unix sytem I got to use worked very well on a 48K PDP-11. A very productive little system.

    • (Score: 3, Funny) by Dr Spin on Tuesday December 30, @05:54PM (6 children)

      by Dr Spin (5239) on Tuesday December 30, @05:54PM (#1428274)

      Debian 12? 1.34 Billion lines of code. (which, of course, includes all kinds of applications the Windows 11 core OS isn't even attempting to implement).

      But can you imagine how many bugs would be in Windows 11 if it did?

      --
      Warning: Opening your mouth may invalidate your brain!
  • (Score: 2) by KritonK on Thursday January 01, @05:51AM

    by KritonK (465) on Thursday January 01, @05:51AM (#1428401)

    I gave it a small spin, and I was surprised to find that the "cd" command was called "chdir" back then. If they didn't give instructions for compiling the kernel, which include a "chdir" command, I would never have figured it out.

(1)