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=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26428 invoked from network); 5 Aug 2021 23:02:46 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 5 Aug 2021 23:02:46 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id A48679CAFC; Fri, 6 Aug 2021 09:02:42 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id F34F29C9E8; Fri, 6 Aug 2021 09:02:12 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=iitbombay-org.20150623.gappssmtp.com header.i=@iitbombay-org.20150623.gappssmtp.com header.b="zrDvpRHC"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id B7B179C9E8; Fri, 6 Aug 2021 09:02:09 +1000 (AEST) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by minnie.tuhs.org (Postfix) with ESMTPS id 9BAC59C9E0 for ; Fri, 6 Aug 2021 09:02:08 +1000 (AEST) Received: by mail-ot1-f54.google.com with SMTP id r16-20020a0568304190b02904f26cead745so6504644otu.10 for ; Thu, 05 Aug 2021 16:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4JYywD1DUNZmlp+AqEn/TxeL5R7cHV3y95Sx9avBAuU=; b=zrDvpRHCumMlLBBIi6iBolndC/WEwHRUx4UPAb/KpR9gwoQ9JCTMTTVYDW0VaYbjld z1N0nth3gJgrhiNAfZbTZbVaWZOWOC6svsZO/pNCx8OqED/BPoxSYoPESz+I3GHHSDIy PZDmtbDH4dLnmIZHtD22U+cQ4EipfwjkbtUNSZGNgvKZp2qVx2TqbWeh2igjybfTcwtU CqAILRQWvz6rtEhayk+AsjnraFA52FOPvgOHaK15KxkzWyufk7TEe6cpd4FVxXlfXwT6 Jo79+lzBjmMUkt4YxhAqV3fdEzH/bNnyc+2rwp6lVldS2f8vS+CzDcccmzN+SrDvGPVZ EvkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4JYywD1DUNZmlp+AqEn/TxeL5R7cHV3y95Sx9avBAuU=; b=enXOl0ypFMKdi76VpNHfgiSCuHJi0unD0KGtXOL8jUKadKTtEMcnNPGGlFWMItWwQo 6729956B6N3A/OuTIrc8lhWK/ANRI1BzSYcea4IQCag2AONh/V3aObZEAjvG/IZG4q94 DFcrhvQCKgBCl1i01lRkATeXmNYmoNk2A2/gJNiQQrglXdkSTEAk5DGd6//cFP3JVUpA 1oZYMsk/T4V6ceo4gErEYwVZ130wkCa9uxY2Q8ZJ5OesS68HjOg+QhHPLFC94/97MgLL IqHf6xYZFmQ2rKgyJSNRQFIy3uC5dHJTDHaDoFvzsmQ9QTKx3XLUKnPO8IjScXcExXzp vKRQ== X-Gm-Message-State: AOAM531d7cMCN92FpC4rBBxxewrr/K8AW/rgjRgahdfqrD0oF4athIs8 zCsSJ9uKIOzb066bQZ/OF+nwTzaftkl3GphZ X-Google-Smtp-Source: ABdhPJwB3w0q2yFcdXS6bIkBllpDpNhRu4XRnp32kRTe2CLWE2QXR2CCa9Q5fvcgSLP5CBSy8NHU6A== X-Received: by 2002:a05:6830:236d:: with SMTP id r13mr5515748oth.130.1628204527842; Thu, 05 Aug 2021 16:02:07 -0700 (PDT) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id q186sm1366992oib.31.2021.08.05.16.02.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 16:02:07 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) From: Bakul Shah In-Reply-To: Date: Thu, 5 Aug 2021 16:02:06 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <74E8349E-95A4-40C9-B429-11A4E396BE12@iitbombay.org> References: To: Lawrence Stewart X-Mailer: Apple Mail (2.3654.120.0.1.13) Subject: Re: [TUHS] Threads vs... not X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Aug 4, 2021, at 2:48 PM, Lawrence Stewart = wrote: >=20 > What do folks think about event-driven programming as a substitute for = threads in UI and process control settings? The equivalence here is with coroutines (sometimes called green-threads), not true threads. True threads can take advantage of multiple cores. Your event-driven program won't benefit from multiple cores. > I wrote the service processor code for the Sicortex Machines using = libevent.a and I thought it was very lightweight and fairly easy to = think about. (This was a thing running on ucLinux on a tiny 16 MB = coldfire that managed the consoles and power supplies and temp sensors = and JTAG access and booting and so forth.) I wrote the RealNetworks media server code using an event-driven model. It was efficient but the control flow got quite messy as effectively my code had to do explicit continuation passing. Given that each media stream was independent of other streams, a thread based model was far simpler. That is what a colleague did to test the server code! As a thought experiment consider implementing a Unix style pipeline but without an OS that provides the illusion of independent processes or threads and where each stage in the pipeline is a separate function. Try implementing this in Go which has support for threads vs C (but without pthreads). I have used coroutines for hardware simulation a number of times, the first time was in 1982 for simulating bus transactions to see the impact of adding an ethernet controller (5.6Mhz clock, memory access 4 clocks). The last time was to simulate an ethernet switch with complex i/o logic. One can think of each hardware module as a separate state machine but smushing them into one giant state machine would not been easy as the code was being developed and debugging it would be very painful. One would then be tempted to write a "preprocessor" language of some sort to hide all this.... > Tk (IIRC) has a straightforward event driven model for UI = interactions. >=20 > Meanwhile, the dropbox plugin for my Mac has 120 threads running. = WTF? Any system can be abused but the abuse-case should not be mistaken for the normal use-case.=