Live data from Hacker News

Writing a Unix clone in about a month

drewdevault.com

51–60 of 140 posts

Re: Writing a Unix clone in about a month

#51
Impressive work but I feel this approach is the hard and brittle way to write an os. The easier and more portable way is to write the os as a guest in a host language. You start with a simple shell with the print command and build from there.

Re: Writing a Unix clone in about a month

#52
post #7

I was interested in Hare until I found this immensely self-defeating FAQ item: https://harelang.org/documentation/faq.html#will-hare-suppor... As a baseline, I support developers using whatever license they would like, and targeting whatever operating systems, indeed, writing whatever code they would like in the process. That doesn't make this specific policy a good idea. Even FSF, generally considered the most extre…

[flagged]

In this particular case, he does not say anything other than "I won't actively work on supporting proprietary platforms because I don't care about them".

Can't we just be grateful when people open source their code without asking anything in return and stop criticizing them because they did not release it under our preferred conditions?

Do you personally maintain useful open source projects? Can I go there and complain about how you proceed even though I didn't contribute anything at all?

Re: Writing a Unix clone in about a month

#53
post #51

Impressive work but I feel this approach is the hard and brittle way to write an os. The easier and more portable way is to write the os as a guest in a host language. You start with a simple shell with the print command and build from there.

I hope it's not too easy then... imagine what he could do in 27 days if this was the "hard and brittle way" :-).

Re: Writing a Unix clone in about a month

#54

This is really cool. Reminds me of the original Unix was invented in a couple weeks while Ritchie's family went on vacation to CA to visit his in-laws. Source: UNIX: A History and a Memoir Paperback – October 18, 2019 by Brian W Kernighan (Author)

But I think it’s relevant to say that before writing Unix he was working on Multics for a long time already. Unix was a “simplified” version of it, if I remember well. So it didn’t “spring out of thin air.”

Absolutely.

Re: Writing a Unix clone in about a month

#56
post #14

Impressive, super cool, and inspiring! Example of “creating something impressive in X days” requires a lot of experience and talent that is built over years .

Also the creator of KnightOS, written entirely in Z80 assembly, more than 12 years ago! https://www.ticalc.org/archives/files/fileinfo/463/46387.htm...

holy shit. they're already a living legend but somehow i didn't make this connection

Re: Writing a Unix clone in about a month

#57
post #35
post #18

> I also finally learned how signals work from top to bottom, and boy is it ugly. I’ve always felt that this was one of the weakest points in the design of Unix and this project did nothing to disabuse me of that notion. Would love any resources that goes in more details, if any HN-er or the author himself knows of some!

Signals are at the intersection of asynchronous IO/syscalls, and interprocess communication. Async and IPC are also weak points in the original Unix design, not originally present. Signals are an awkward attempt to patch some async IPC into the design. They're prone to race conditions. What happens when you get a signal when handling a signal? And what to do with a signal when the process is in the middle of a system…

As I wrote in some older discussion about UNIX signals on HN, the root problem (IMHO, of source) is that signals conflate three different useful concepts. The first is asynchronous external events (SIGHUP, SIGINT) that the process should be notified about in a timely manner and given an opportunity to react; the second is synchronous internal events (SIGILL, SIGSEGV) caused by the process itself, so it's basically low-level exceptions; and the third is process/scheduling management (SIGKILL, SIGSTOP, SIGCONT) to which the process has no chance to react so it's basically a way to save up on syscalls/ioctls on pidfds. An interesting special case is SIGALRM which is an asynchronous internal event.

See the original comment [0] for slighlty more spellt out ideas on better designs for those three-and-a-half concepts.

[0] https://news.ycombinator.com/item?id=39595904

Re: Writing a Unix clone in about a month

#58
post #42

Earlier quoted context omitted.

There were UNIX written in Ada and Pascal, naturally C has a special relationship.

Really??

In France, in the 1980" there was a Unix clone written in Pascal by the CNET (the R&D of the incumbent phone operator). The CPU was a M68K and the hard disk had 20Mbytes (if I recall correctly). I don't remember the name of the beast.

Re: Writing a Unix clone in about a month

#60

This is really cool. Reminds me of the original Unix was invented in a couple weeks while Ritchie's family went on vacation to CA to visit his in-laws. Source: UNIX: A History and a Memoir Paperback – October 18, 2019 by Brian W Kernighan (Author)

I think you mean Ken Thompson. I can't be bothered searching through youtube interviews but I'm pretty shure that on more than one occasion, he tells a story something along the lines of having a disk driver, some programs, and maybe some other components. His wife went on a trip and he figured it would be enough time to fill in the gaps and make a complete OS.
Post reply on HN