Hacker News new | ask | show | jobs
by jibalt 3 days ago
For good reason -- it was buggy! It used the wrong stack. They fixed it in V7.

I was a UNIX kernel hacker working for Interactive Systems Corporation. I studied and hand simulated that code, understood it, and saw that it was buggy, but I don't remember whether that was before or after I saw the fix in the V7 kernel code.

2 comments

And the comment was as Wikipedia page explains, just a Lions note his students not to worry being asked in exam.

https://en.wikipedia.org/wiki/A_Commentary_on_the_UNIX_Opera...

No, the comment wasn't Lions', it was in UNIX.
Yes, you are correct. It was Richie who wrote it. My bad. But Richie intention was same, viewing from Lions point it was perhaps same. He didn't expect his students to understand that part.
There is no "viewing from Lions point", and Ritchie wasn't an instructor and wasn't giving exams. You simply misunderstood and misreported what the Wikipedia page says -- you took the words literally while ignoring the "in the spirit of" comment. And your comment, in addition to simply being wrong, was quite out of place as a response to mine.
Not really, they just didn't have setjmp/longjmp yet, they used something else. The real thing you weren't meant to understand was why a routine that was never called returning a value and mostly didn't return a value had to return "1" at that particular point

https://www.taniwha.com/~paul/not.html

(I worked for another competitor, UniSoft, SCO ripped us off too, on the 286 port)

Yes really, naysayer. They had to fix it in V7 because the code didn't work on the Interdata ... the V6 code only happened to work because of specifics of the PDP-11's calling convention.
Note that I didn't say that it was "broken" on the PDP-11 in the sense that the code failed, rather that it was buggy. The savu/aretu mechanism was maldesigned and only worked on the PDP-11 by coincidence, as Ritchie later acknowledged, saying “we didn’t understand what was going on either.” (And no, the comment wasn't about returning 1.)

It's bizarre to say "they just didn't have setjmp/longjmp yet" ... they wrote a fundamentally wrong context switch mechanism. When they realized that it was wrong while trying to debug it for the Interdata port, they wrote save/restore, which wasn't buggy. Later, save/restore was added to libc as setjmp/longjmp.

Oh totally, I think I made it clear in the writeup that it depended on the pdp11 calling conventions, but it wasn't broken on the pdp11 (and I was able to make it work on my V6 Vax port)