From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: tuhs-bounces@minnie.tuhs.org X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id efcf0aa2 for ; Fri, 29 Jun 2018 16:59:20 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id C8E77A1B2A; Sat, 30 Jun 2018 02:59:19 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id EEDC0A1849; Sat, 30 Jun 2018 02:59:07 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.b=sRkXt7S2; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 0082DA1849; Sat, 30 Jun 2018 02:59:05 +1000 (AEST) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) by minnie.tuhs.org (Postfix) with ESMTPS id 75822A1815 for ; Sat, 30 Jun 2018 02:59:05 +1000 (AEST) Received: by mail-io0-f181.google.com with SMTP id i23-v6so9030113iog.10 for ; Fri, 29 Jun 2018 09:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OZ6J8CaJ4U3XyPOGNPGSUbme32hEufKxI1ZWJKgwYAc=; b=sRkXt7S2+IDmd0dlWgDwqHZ7kMJPMasOja9ZVqB8iFbtwgpMcxjJmIegq86T22Wbsc mtPyMVCYXwayifyLjZDTdY9ZHpjVHu3vs0ZOUruRBH/UajniO/grnh1KF8MPlyhtAd/N TC+hQaR9zAzpCVRRkZpfiYI+JggaiqjDDt8KTNYLCBt2rPRM+Fi6HKxX+a3wYuuffDpu 56qlOZDwQoRu1TIOnYtZ4Lt10aqzc94RO5A9AFLXGeHh3zNuocKaNVkhTqhl7QWIe2o0 qjqleCVjsDC8lSM2G1nHbfTzs8zUAwoUm6W3LDBdjUEk5azpTjzvJVpdZV0MDgeCLVS3 /CxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OZ6J8CaJ4U3XyPOGNPGSUbme32hEufKxI1ZWJKgwYAc=; b=jtuBsboYMaJNNQoObYQabP+B7Xoxs5cLKN2KSBk/bXvSFEdRFsX0XUtT56lTGg/I7/ FmaS4nIVqzQzF4lgZC3Kh6Qe3rL1gf1EWrNLLrTqysLd805A1Le7SID2FHJS/UBVarMy lFL9uoQf3V1ubpXwWhuzulHeUjXwe7eiea2frXZMtx2YsjgUY5VZGfPIBOgp+uiKhAwI mLgYGNAuJklR5dJMkaoDM8ipQr62g1OQiFeKSVc6ncWumbmXJZyN1puNZWt++WxvYbcf 0LlZMdBLLJBXXKv24JAzhtFjsdGXry97SgdDEQ//X2ZMK3Apezriyv+wyck2wyLPuFow wBow== X-Gm-Message-State: APt69E28XditqqilUa1sQ94I4TkoVG873OmxoZuDqCEyaNP5fYopDMvc hyQMpd2lHltOuOuQeoZ0u+1hhjjpTyAcjswIN2aRGA== X-Google-Smtp-Source: AAOMgpciFIBm7XKqSBx/4+Fekv1MQu0T6EVRpife1MmzMlYcw1UcoEawjXzAD4ZHHsJ1kPNWFKvz3bClPUETVMUVG+0= X-Received: by 2002:a6b:d40c:: with SMTP id l12-v6mr13132731iog.37.1530291544584; Fri, 29 Jun 2018 09:59:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:5945:0:0:0:0:0 with HTTP; Fri, 29 Jun 2018 09:59:03 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <012201d40fc6$137b3590$3a71a0b0$@ronnatalie.com> References: <012201d40fc6$137b3590$3a71a0b0$@ronnatalie.com> From: Warner Losh Date: Fri, 29 Jun 2018 10:59:03 -0600 X-Google-Sender-Auth: sSzL9OgbsZ6GP4toU7ZLl4DEciA Message-ID: To: Ronald Natalie Content-Type: multipart/alternative; boundary="000000000000eb152e056fcac363" Subject: Re: [TUHS] C Threading 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: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000eb152e056fcac363 Content-Type: text/plain; charset="UTF-8" On Fri, Jun 29, 2018 at 10:27 AM, wrote: > Thread local storage and starting threads up is largely a rather > inconsequential implementation detail. When it comes down to actual > parallel programming, of which I have done more than a little, the big > thing > is thread synchronization. It's rather hardware dependent. You can > pretty much entirely wipe out any parallism gains with a synchronization > call that results in a context switch or even a serious cache impact. On > one side you have machines like the Denelcor HEP where every memory word > had > a pair of semaphores on it and the instructions could stall the process > while waiting for them and the hardware would schedule the other threads. > On the other hand you have your x86, which you can do a few clever things > with some atomic operations and inlined assembler but a lot of the > "standard" (boost, pthread, etc...) synchs will kill you. > C11 also defines thread APIs and atomic operations sufficient to do many types of locking. POSIX layers on threads as well that could be implemented using those atomics. Warner --000000000000eb152e056fcac363 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, Jun 29, 2018 at 10:27 AM, <ron@ronnatalie.com>= wrote:
Thread local storage and starting= threads up is largely a rather
inconsequential implementation detail.=C2=A0 =C2=A0When it comes down to ac= tual
parallel programming, of which I have done more than a little, the big thin= g
is thread synchronization.=C2=A0 =C2=A0 It's rather hardware dependent.= =C2=A0 =C2=A0 You can
pretty much entirely wipe out any parallism gains with a synchronization call that results in a context switch or even a serious cache impact.=C2=A0= =C2=A0 On
one side you have machines like the Denelcor HEP where every memory word ha= d
a pair of semaphores on it and the instructions could stall the process
while waiting for them and the hardware would schedule the other threads. On the other hand you have your x86, which you can do a few clever things with some atomic operations and inlined assembler but a lot of the
"standard" (boost, pthread, etc...) synchs will kill you.

C11 also defines thread APIs and atomic operat= ions sufficient to do many types of locking. POSIX layers on threads as wel= l that could be implemented using those atomics.

W= arner

--000000000000eb152e056fcac363--