From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 00307ce9 for ; Tue, 4 Dec 2018 22:11:49 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id D55D9A2226; Wed, 5 Dec 2018 08:11:48 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id A947DA1F04; Wed, 5 Dec 2018 08:11:39 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id EAC17A1F01; Wed, 5 Dec 2018 08:11:13 +1000 (AEST) Received: from mail.bitblocks.com (ns1.bitblocks.com [173.228.5.8]) by minnie.tuhs.org (Postfix) with ESMTP id 6643CA1EFF for ; Wed, 5 Dec 2018 08:11:13 +1000 (AEST) Received: from mob.bitblocks.com (mob.bitblocks.com [192.168.125.11]) by mail.bitblocks.com (Postfix) with ESMTP id 3CE3E156E41B; Tue, 4 Dec 2018 14:10:51 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) From: Bakul Shah In-Reply-To: <20181204213452.GI3316@mcvoy.com> Date: Tue, 4 Dec 2018 14:11:27 -0800 Content-Transfer-Encoding: 7bit Message-Id: References: <1543705783.3909.for-standards-violators@oclsc.org> <20181203011414.DAE3D156E410@mail.bitblocks.com> <20181203013025.GB10043@mcvoy.com> <20181204213452.GI3316@mcvoy.com> To: Larry McVoy X-Mailer: Apple Mail (2.3445.101.1) Subject: Re: [TUHS] man-page style X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Dec 4, 2018, at 1:34 PM, Larry McVoy wrote: > > On Wed, Dec 05, 2018 at 08:26:29AM +1100, Dave Horsfall wrote: >> On Sun, 2 Dec 2018, Larry McVoy wrote: >> >>>>> And anyone who has not edited sendmail.cf (shudder!) is not a >>>>> programmer. >>> >>> As a systems guy I think if you have not written, or understood, swtch(), >>> you are not a systems guy. >> >> Ahh, line 2238... > > I dunno what line it is, I'm guessing that's the # for the Lions book? > > I learned swtch() because I wrote a userland thread library for Udi Manber > as a grad student (yield based as I recall). I'd never really thought > about it hard, yeah, did all the CS toy OS stuff but I don't think they > made us write that. I loved writing it, I did a super minimal one that > had the bulk of the work in C, just did the save/restore in asm. I too built a coroutine library. We used it for simulating some real h/w we were building. The nice thing about h/w simulation is no recursion so your threads can work with as little as 50-100 bytes of stack, so even on a 64MB machine 100K threads was not a problem! There is no yield() here being a simulation core. Thread switch occurs in wait(), signal() & busy(n) -- the last one to simulate passage of time. I built the very initial version in 1982-83 using setjmp/longjmp! We used it to check if our 5.6Mhz bus could support ethernet traffic while doing other things. Of course, this is much simpler than a unix swtch().