From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20945 invoked from network); 13 Nov 2022 01:53:20 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 01:53:20 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 4B6DD41E21; Sun, 13 Nov 2022 11:53:07 +1000 (AEST) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) by minnie.tuhs.org (Postfix) with ESMTPS id 2993A41E20 for ; Sun, 13 Nov 2022 11:53:00 +1000 (AEST) Received: by mcvoy.com (Postfix, from userid 3546) id 53EAE35E92A; Sat, 12 Nov 2022 17:52:59 -0800 (PST) Date: Sat, 12 Nov 2022 17:52:59 -0800 From: Larry McVoy To: Rob Pike Message-ID: <20221113015259.GJ9823@mcvoy.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Message-ID-Hash: PQB42GQ6KHMXX4OFZVQVXI3AE6A76ZCI X-Message-ID-Hash: PQB42GQ6KHMXX4OFZVQVXI3AE6A76ZCI X-MailFrom: lm@mcvoy.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: The Eunuchs Hysterical Society X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: Book: "You Are Not Expected to Understand This" List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Sun, Nov 13, 2022 at 12:12:32PM +1100, Rob Pike wrote: > See https://github.com/plan9foundation/plan9/blob/main/sys/src/9/port/proc.c > for instance - almost all of sched is bookkeeping and a comment about > locks. The little burst at the bottom, starting around line 163, that does > the work is so compact. (setlabel and gotolabel are setjmp and longjmp.) This reminds me of code I did for Udi Manber as a grad (or undergrad) student. He wanted a user space threads library so I wrote one. It's where I learned how to write swtch() where you enter as one thread and exit as another one. 99% of the code was C that did all the stuff you could do in C and then a small amount of assembler that did the flip. I had heard that swtch() was hard but it really isn't that bad. The assembler makes you learn that stuff but you need to know that stuff anyway. I do agree with people who say you aren't a kernel engineer if you haven't written, or at least understood, that code.