From owner-freebsd-questions@freebsd.org Mon Jun 14 22:37:08 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49CDD656F5E for ; Mon, 14 Jun 2021 22:37:08 +0000 (UTC) (envelope-from Norman.Gray@glasgow.ac.uk) Received: from hillend.cent.gla.ac.uk (hillend.cent.gla.ac.uk [130.209.16.102]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G3mXf4xpzz3Mxs for ; Mon, 14 Jun 2021 22:37:06 +0000 (UTC) (envelope-from Norman.Gray@glasgow.ac.uk) Received: from cas08.campus.gla.ac.uk ([130.209.14.165]) by hillend.cent.gla.ac.uk with esmtp (Exim 4.72) (envelope-from ) id 1lsvCZ-0000qq-NN; Mon, 14 Jun 2021 23:37:03 +0100 Received: from CMS09-02.campus.gla.ac.uk (172.20.14.170) by cas08.campus.gla.ac.uk (130.209.14.165) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 14 Jun 2021 23:37:02 +0100 Received: from cas07.campus.gla.ac.uk (130.209.14.164) by cms09-02.campus.gla.ac.uk (172.20.14.170) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 14 Jun 2021 23:37:02 +0100 Received: from GBR01-CWL-obe.outbound.protection.outlook.com (104.47.20.54) by cas07.campus.gla.ac.uk (130.209.14.164) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 14 Jun 2021 23:37:02 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIcY0c3yT/YpjCHX1hWUg89fccQxKKJpFTJG7475nWIrxEmpEfiHkItEGdpB7+crPfSt+jszTOdGxDy1TGuapMtH/jpVHpXhohQCMzUG3RyQ5x6eEALeguHEJeDzfVcvPMh+6jpt90IqTXufhT2u6qoGotaCjvQlZNFCBhp7ofnlENuyoPrnG7IoIPeFWGgkPkmxDuAmHVrLa+JiEHzbG/ovGPlBZG323Vcq8K0XxAluLj2l90Jzh6ZLEOizO9W/pUwL/SEsB4wl6crFpKih++3+A7D9zbvD/kTLA2vyjrMK1fJExEREEf+R0AvWwIWLP1SQUMPK9yQmOza2vRTXLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VqvFwl9NbSQW09EqT+RBINHbVvUP5LnrEBHEpNd/H08=; b=jO/WPhbFWV4+ujL2t0HA5IkU58OOy5qvut+vKKH11WQQVQoqVc6j+AJNtx1iQzDAEYHWEjqsZoRCgOsgHAo+MeydjSV9mlkTGujJ1NxsCD19mGQmYnKF/NhQlZb+jx4xh+FAoxJz1TN6eBX6Sk5vnaNJriCxQzEwriTJ3blUT0k5qT+l00HF1tpd8E3ipfVwkWoJKmuJkCRdGnT5ilbbeOBFynUey13Mrxm1LIJ4mUlYdkqs+cpmhb76mvFFLALY6EZ+XcBBx3aDzDIcA3PH5QT88Rr4vmBguWFzr5WK4q7x7JERdf2d6zZa1qzXJXiIxF+fhcvZ3Cdl2LD7wFrECA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=glasgow.ac.uk; dmarc=pass action=none header.from=glasgow.ac.uk; dkim=pass header.d=glasgow.ac.uk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gla.onmicrosoft.com; s=selector2-gla-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VqvFwl9NbSQW09EqT+RBINHbVvUP5LnrEBHEpNd/H08=; b=n2MJ2HkJt0dW5Tqp5ZDqAsY7kAstfVcxcKSKSwwmW+Up2NAKiahY381F8UWh2c4tPnzYnaAi0ewdZRfDTYBvWD4xfmB7bZKBFvGJkekix/rXz+f0hcB3LvqgQU5YlCaO2ihY3OtviOVJ1RqfCcxj8vzORGzxUiJ9A0Beg2J0/W0= Received: from CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:d4::7) by CWXP265MB4023.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:122::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.23; Mon, 14 Jun 2021 22:37:02 +0000 Received: from CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM ([fe80::977:cd20:64d7:e0bf]) by CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM ([fe80::977:cd20:64d7:e0bf%4]) with mapi id 15.20.4219.025; Mon, 14 Jun 2021 22:37:02 +0000 From: Norman Gray To: "Ronald F. Guilmette" CC: John Levine , Subject: Re: Periodic tasks are not nice Date: Mon, 14 Jun 2021 23:37:00 +0100 X-Mailer: MailMate (1.14r5769) Message-ID: In-Reply-To: <3360.1623703751@segfault.tristatelogic.com> References: <3360.1623703751@segfault.tristatelogic.com> Content-Type: text/plain; format=flowed X-Originating-IP: [2001:8b0:df5:af53:2c1b:f35f:c01a:bdea] X-ClientProxiedBy: LO4P123CA0278.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::13) To CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:d4::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.10] (2001:8b0:df5:af53:2c1b:f35f:c01a:bdea) by LO4P123CA0278.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Mon, 14 Jun 2021 22:37:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0123742a-efc5-4345-0a18-08d92f84ed8f X-MS-TrafficTypeDiagnostic: CWXP265MB4023: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NC0dSqGwlUIvmEZYv9vxO/lGkg1gMZ4ZNzABO6h3KJpQZlxQ4K0/th5+bAJqo0px6XuC0C7Y1G81fNpcPA+kTeK7wBnUU2+7+Z3DAhEOFtv4PePrW2FxeQMlLiwp/hlMs+dU1TDhHlWs/pH6vQJzBMndVe7aIU+NODQcYMtFbqvwM2EPcWwd8WPWhPI3CHOS5oqg6axPabRSnFABUAdBDtt2a0OP/ZxNcrA7qADrpVE1kq147RfeuxmBd2fBcPAyg9qe2pIIUS/fzYSD01iKhco3cwo3I9+IeOldLESZHWkJ8P94N9NNd+WY6shfA1lIeSlAFAIcaZJsOe2LLYYCh9ilUbYo03Lkl1pKY/GsV5QaQipaNhntvRlR+TFG/VOU2sgj/3OWiQ/j64abV6ErInPdFur4gB3LI6XmHKAzs75ybfilfd3vkhVb95QOJpaDDMlEFAGBd3D+CtypY9DS/INameGaMPRl5RKQhiLUcEwuPzT2awL4oxa9MpXRQtWm9zisPcRv+aazlpaUYnihx0qfJUpVxiW0Pv1oXqCS4RKAdBoqXAluQrkPjC+GDGkzmv6LtK9oh38h/xmJvGRBaKwa5bGNralcuMet8tnIpXnOZtkEH7fXWZTC9z2kQ3HD8AYqU9/D9SPZhIZVDoLLNoLeD5NzBLBKV4ZpN1fhB0HihEPKDBNpo3G640uCrXsC4SlLRgN+ajTJeI4b/IEHiYxEcx7cNgHCq7kYMrtIu2T6sHpdeZVWe0zMl6IX7PC3rha72jM9c4rNyIUKPJX7vA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(186003)(16526019)(36756003)(44832011)(6486002)(316002)(5660300002)(478600001)(66946007)(83380400001)(66476007)(66556008)(33656002)(4326008)(53546011)(966005)(86362001)(8936002)(38100700002)(2616005)(786003)(6916009)(8676002)(2906002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?GEAxTzpsGASgEXYdpawVzKEBz1EMfK7zUWYJIDvqgzLNCu0sLBgjTbZdF6gv?= =?us-ascii?Q?WfXeJCuPaaxDm0mNFzlO99NRqLxpmrrxM6VqyEac5qkPwniGLIBhv4HVMSuY?= =?us-ascii?Q?6FUMFQcf5CuC/Nty+qQG4iACoAOY2EqTKZLn2uWQ3M/8CAiyd8iTF2KR+vG9?= =?us-ascii?Q?Ck/gNuno1l3cjGNXfZQ/pQbI0IX0EVgyhUZi9Wemp+CHMsMwK8a4AZd7QqoL?= =?us-ascii?Q?1UAPrHAYaMooKB9C2qVn6XAhY20ycvXZz/c67auVeZkzzPWGVgor5+RvOLUO?= =?us-ascii?Q?OuRdeQdSxUEW+mHefVImYld3nBcWaJJ1s36v/Uk/YWLCgZYoHGXjQ3ggwVT/?= =?us-ascii?Q?mNa2zlTTMJezdNtew7L+Y0UrJxyBpfsnQzAFn+sHSyqFzvOCQw0mAuvKhQvs?= =?us-ascii?Q?ZMn7I2YfiRvAQj+aq+apudMDNIxWAJGaey53myCzaueQkJD+wYHrqPO/ZO3l?= =?us-ascii?Q?Dde3HEysWNyW2+BySXOlWokJU8FEd9oYDJAgTS4xd0xWcLFGveYCumUBYPNv?= =?us-ascii?Q?wm4yXYNuga3pP9gBQr5SrFHR8RMEkeXVPtLHghLsuKAXCyNbKBQw99tqqNsc?= =?us-ascii?Q?4Qvjm2SumA2OFHP1lOwKHiTmEv9rcFoTakbw7V5BNmY7hJGVmXYlvzglcJuk?= =?us-ascii?Q?u6BMXcjglc9Ds4gBLOBSfR9+UJ6BQAtcXkpabgjhPSbccuXBSu9nNyrFqV0F?= =?us-ascii?Q?lQoOPdIk6FEDAU0kpvfTazC857KCdMWRRz3EpFLH1KcMGmxglWza6pqso288?= =?us-ascii?Q?AniAIPfI9Yc5yPcW0mKl6kQxBc219fP/LQj/9ueTwW/c0lcPX9q2Y8gA5g6V?= =?us-ascii?Q?kKOC7WZpZjwKxl6G8uPKke99Zq+ue44wB9iKHjv0hYqPm/OxiktREfI0axyO?= =?us-ascii?Q?0VVlHMXYPIWDbJFLZeqRG1XpVlejoc+XR4w5NaL4kpChiqGgQkpOsXVlvbSr?= =?us-ascii?Q?vSujGVpq7n8qnj5CdtzFwixTpkcLlr3yhwIY9TQZvlV7AQCCN3wOBsshVJUU?= =?us-ascii?Q?liT2brMFcV6jKegDn6OcRY14MWOPc2NvnG43Kntw/Lij7USIlcrvrR2wGLm9?= =?us-ascii?Q?YrR6VVzux+jvDSRA9qkaJ9SmNChhsQeyTQ3pwtqkICj7JBcuOfUrSZMUP5M0?= =?us-ascii?Q?LAouxTBrVlYMxB+8Ov+bIpHhvO/Ny6bG7SopnIhKng4xI5avAn6uCJhfJKpQ?= =?us-ascii?Q?rUSTg58M2kvRc8ayBOyNvo4W3MvFU93i6ViIguOpZYhPpmfn8Yr0Bqjj5se0?= =?us-ascii?Q?qhlEmdiLzbd85/NIlGO2E/r/g/LapBTN9QHG4D0CJF6Kksp/+NTcVpR2CQ1G?= =?us-ascii?Q?8tFzPD3IQYjI0PupVX6O7Hi8X8NSmJUm3wNPaf1aX3DFqrl2SaEYaTA9Tzqf?= =?us-ascii?Q?jjSt0DG/5RbIuTz5HEVmVZo5Zbmb?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0123742a-efc5-4345-0a18-08d92f84ed8f X-MS-Exchange-CrossTenant-AuthSource: CWLP265MB3361.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2021 22:37:02.1749 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6e725c29-763a-4f50-81f2-2e254f0133c8 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l6kwJwaqahOAdIYVlhzA9lS9+LKvS468Ad3rXuFRIrQH/LenSVKs7JvfC+W1IgqpGbkkIGYjq+12abD89CkaRfHtgIs8eqEJC/9JGDvtue0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWXP265MB4023 X-OriginatorOrg: glasgow.ac.uk X-Rspamd-Queue-Id: 4G3mXf4xpzz3Mxs X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gla.onmicrosoft.com header.s=selector2-gla-onmicrosoft-com header.b=n2MJ2HkJ; arc=pass (microsoft.com:s=arcselector9901:i=1); dmarc=none; spf=pass (mx1.freebsd.org: domain of Norman.Gray@glasgow.ac.uk designates 130.209.16.102 as permitted sender) smtp.mailfrom=Norman.Gray@glasgow.ac.uk X-Spamd-Result: default: False [-5.20 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gla.onmicrosoft.com:s=selector2-gla-onmicrosoft-com]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:130.209.0.0/16]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[glasgow.ac.uk]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[130.209.16.102:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[130.209.16.102:from]; DKIM_TRACE(0.00)[gla.onmicrosoft.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:786, ipnet:130.209.0.0/16, country:GB]; RCVD_COUNT_SEVEN(0.00)[8]; MAILMAN_DEST(0.00)[freebsd-questions]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 22:37:08 -0000 Ronald, hello. On 14 Jun 2021, at 21:49, Ronald F. Guilmette wrote: > But on the other hand, if a given process is starved of CPU, then it > will naturally be less able to suck up all of the available actuator > movements of the spinning rust disks that I am still cheap enough to > own, yes? For me, the aha! here is that nice doesn't artificially starve a process of CPU, it merely puts it to the back of the queue when the kernel is scheduling it. That means that _if_ there is a shortage of CPU, then the process will not be given a turn on the CPU very often (depending on the value of the niceness). If, on the other hand, there are two (single-threaded) processes running, A and B, with only the second one niced, and two CPUs, then there is _no_ shortage of CPU. Thus B can be given the second CPU to play with, without disrupting A. Both CPUs will be fully utilised, and the CPU scheduling queue will be empty most of the time. If A were multi-threaded, then it would be possible for the kernel to schedule it on both CPUs. In that case, the kernel would do so more often for A than for B, and B would be starved. Returning to the case where A is single threaded, consider the case where B, again making full use of a CPU, is doing something which is thrashing the disk. This time, the kernel will spend more time servicing process B and its disk accesses, so A will end up waiting in a queue for disk access, and so be slowed down by B, even though it's B that's niced. (I'm sure no-one will hold back from correcting me if I've misunderstood something, or skipped a subtlety). Best wishes, Norman -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator SUPA School of Physics and Astronomy, University of Glasgow, UK Charity number SC004401