From: Larry McVoy <lm@mcvoy.com>
To: Rob Pike <robpike@gmail.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: [TUHS] Re: Book: "You Are Not Expected to Understand This"
Date: Sat, 12 Nov 2022 17:52:59 -0800 [thread overview]
Message-ID: <20221113015259.GJ9823@mcvoy.com> (raw)
In-Reply-To: <CAKzdPgzAPB+-LjtZ+rhqRY8+Cdk4Fqks5hK1EdmShT_QbGHKjg@mail.gmail.com>
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.
next prev parent reply other threads:[~2022-11-13 1:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-13 0:02 [TUHS] " Dave Horsfall
2022-11-13 0:25 ` [TUHS] " Kenneth Goodwin
2022-11-13 1:12 ` Rob Pike
2022-11-13 1:52 ` Larry McVoy [this message]
2022-11-13 1:12 ` Stuff Received
2022-11-13 21:58 ` Dave Horsfall
2022-11-14 22:48 ` Dave Horsfall
2022-11-14 14:14 Douglas McIlroy
2022-11-14 15:50 ` Clem Cole
2022-11-14 16:58 Norman Wilson
2022-11-14 19:17 ` Larry McVoy
2022-11-14 19:50 ` Dave Horsfall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221113015259.GJ9823@mcvoy.com \
--to=lm@mcvoy.com \
--cc=robpike@gmail.com \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).