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, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32331 invoked from network); 6 Aug 2021 14:20:12 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 6 Aug 2021 14:20:12 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 583549CAEC; Sat, 7 Aug 2021 00:20:08 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id C14F89C9E8; Sat, 7 Aug 2021 00:19:34 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id D8C029C9E8; Sat, 7 Aug 2021 00:19:30 +1000 (AEST) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id E71599C9E0 for ; Sat, 7 Aug 2021 00:19:29 +1000 (AEST) Received: from kent.sdaoden.eu (kent.sdaoden.eu [10.5.0.2]) by sdaoden.eu (Postfix) with ESMTPS id 4CBD016056; Fri, 6 Aug 2021 16:19:27 +0200 (CEST) Received: by kent.sdaoden.eu (Postfix, from userid 1000) id EB794775; Fri, 6 Aug 2021 16:19:24 +0200 (CEST) Date: Fri, 06 Aug 2021 16:19:24 +0200 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Bakul Shah Message-ID: <20210806141924.O2Y1R%steffen@sdaoden.eu> In-Reply-To: <74E8349E-95A4-40C9-B429-11A4E396BE12@iitbombay.org> References: <74E8349E-95A4-40C9-B429-11A4E396BE12@iitbombay.org> Mail-Followup-To: Bakul Shah , Lawrence Stewart , TUHS main list User-Agent: s-nail v14.9.22-173-g196623ce38 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. 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" Bakul Shah wrote in <74E8349E-95A4-40C9-B429-11A4E396BE12@iitbombay.org>: |On Aug 4, 2021, at 2:48 PM, Lawrence Stewart wrote: |> |> 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! Only twenty years ago but i was under the impression that i got good (better) performance by having a single event loop object (thread) doing the select(2) aka the OS interaction, as the driver under the hood of an IOEvent thing, which then were emitted. These then dispatched to worker threads, or not. It may be different today with those highly refined mechanisms poll, epoll, kqueue. It may anyway be different with whatever operating system specific things, for example FreeBSD had or has some network ring where user and kernel space could simply exchange buffers, ?, well i remember it was written by an Italien (Professor?) living in Pisa, in sight of the lopsided tower. And then the audioring technology Creative Labs shipped with X-Fi ~2005. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)