Live data from Hacker News

Writing a Unix clone in about a month

drewdevault.com

41–50 of 140 posts

Re: Writing a Unix clone in about a month

#41
post #37
post #33

Earlier quoted context omitted.

That wouldn't be too hard if GPU's would have a stable interface. Try programming a GPU in Assembly language and see how that goes. The experience sucks, but that's the level that needs to be targeted in case of an OS.

For example, in the past Amiga computers had a 'GPU' (although much less powerful than todays GPUs) with a stable interface. It was a first class citizen in its OS. It also was incredibly easy to target in Assembly language.

Blitter was great, but those were simpler times.

The best we have nowadays is using compute shaders for the same purpose.

Just like when using a TMS34010 with its C SDK.

Re: Writing a Unix clone in about a month

#43

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 thought that story was about 3 programs that were missing, a text editor being one of them.

I'll have to check because my memory is failing me atm.

Re: Writing a Unix clone in about a month

#44

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 thought that story was about 3 programs that were missing, a text editor being one of them. I'll have to check because my memory is failing me atm.

> I allocated a week each to the operating system, the shell, the editor and the assembler

http://www.groklaw.net/article.php?story=20050414215646742

Re: Writing a Unix clone in about a month

#45
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!

If you haven't already, I would start with Advanced Programming in the Unix Environment by Stevens

https://www.amazon.com/Advanced-Programming-UNIX-Environment...

It is about using all Unix APIs from user space, including signals and processes.

(I am not sure what to recommend if you want to implement signals in the kernel, maybe https://pdos.csail.mit.edu/6.828/2012/xv6.html )

---

It's honestly a breath of fresh air to simply read a book that explains clearly how Unix works, with self-contained examples, and which is comprehensive and organized. (If you don't know C, that can be a barrier, but that's also a barrier reading blog posts)

I don't believe the equivalent information is anywhere on the web. (I have a lot of Unix trivia on my blog, which people still read, but it's not the same)

IMO there are some things for which it's really inefficient to use blog posts or Google or LLMs, and if you want to understand Unix signals that's probably one of them.

(This book isn't "cheap" even used, but IMO it survives with a high price precisely because the information is valuable. You get what you pay for, etc. And for a working programmer it is cheap, relatively speaking.)

Re: Writing a Unix clone in about a month

#47
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]

Re: Writing a Unix clone in about a month

#48
post #36
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!

I always felt VMS' mailbox system was much more elegant, but I imagine it's an ugly mess under the surface too. https://wiki.vmssoftware.com/Mailbox

I like Plan 9's notes: http://man.postnix.pw/9front/2/notify

Re: Writing a Unix clone in about a month

#49
post #29

Earlier quoted context omitted.

I don't think that Apple particularly cares about porting their software to Linux. Do you feel the same about Apple? That with such an attitude, they surely cannot succeed?

Apple releases a great deal of open source software, which, so far as I'm aware, all runs on Linux as well. At least Swift, clang, and LLVM, all run on Windows as well. So does their Objective C compiler, so of Apple's programming languages , that leaves AppleScript. I would not describe AppleScript as robustly successful. I believe Apple could probably get away with keeping Swift proprietary, or only supporting Appl…

> so of Apple's programming languages

So the whole part of your message about "even the FSF saying that free software should run on proprietary system" works when you want to criticize Hare, but not when looking at Apple proprietary software, right?

A language is just another piece of software, I don't see why you should apply different rules to a programming language than, e.g. to a serializing system like Protobuf. And I don't think Google actively supports swift-protobuf (https://github.com/apple/swift-protobuf).

Hare upstream just says "we are not interested in supporting non-free OSes, but we won't prevent you from doing it". It's your choice to not use Hare because of this, but it's their choice to not support macOS.

Re: Writing a Unix clone in about a month

#50
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!

There were differences between BSD and SYSV signal handling that were problematic in writing portable applications.

https://pubs.opengroup.org/onlinepubs/009604499/functions/bs...

It's important to remember that code in a signal handler must be re-enterant. "Nonreentrant functions are generally unsafe to call from a signal handler."

https://man7.org/linux/man-pages/man7/signal-safety.7.html

Post reply on HN