From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id A0C783858D20 for ; Sun, 15 Oct 2023 03:55:16 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0C783858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=3.97.99.32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697342119; cv=none; b=lMj3n/NlKOOoh9J9GmXePDZrDYFaGQIt3y0crKpQshL6KHkPDo2JNYoGlO/yLTGCRhAoJk9T3RLfRrUZ+NQwgV3JIJRoAFQ2oidAMAO3RT8fCS67cOuEPRdRJZ73Nkb3CeLMUPwgCj8igcobGGU+zT7gLaN7z7Ra9dTdm6rOnmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697342119; c=relaxed/simple; bh=Yl+SVdSgxh8IPTRpqinvOH6N+GrWnHV4UKsrYoKyaHc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=tVEwb/kG/BrB/W0C+W7owQwSYTCcdfY1DU+ErhpGwyZMzS472C8OG4Ysw/wwIeuXfWW7xSuTW1K2FyBmW/1WPH2hsgV+QwuS3EPgHrRaHabUsq+7t/p1QO2WVBi+97Wynxh1tzbKsYGMqHGyfQNvaXI4i6FFWMBSSw1CWnjs1kw= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0C783858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=Shaw.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=shaw.ca Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTPS id rdJXqpxaYmfesrsDkqobti; Sun, 15 Oct 2023 03:55:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=shaw.ca; s=s20180605; t=1697342116; bh=Yl+SVdSgxh8IPTRpqinvOH6N+GrWnHV4UKsrYoKyaHc=; h=Date:Reply-To:Subject:To:References:From:Cc:In-Reply-To; b=fOlZfdcQ07oNYs3IM9nO/Il2/hAJn9bBgfTPt5k4Ey+Xn7l25oKaxq5/+x7OMvuj6 6u7AtH4DUUv2ZM85Leb+gFTPBhihLJLRDwhsvUhesNg5FamcH34QGNidhfjbEVMUHz FTCZpz8/55m0DWwo/9NvxrSjZWZyzlM6FOJBjIOTQDcOcRNDuavAqj8SCjVUZsMLrD UfW0ARs7D8xPENL38rkGEsRrWe0FFQ6arsx/Mfxm7wFiKBj7zMqYMD7Dtdex3tkbfe sh3AUxEBNYWIEsR2K+EEJx1CvFwHibhA5OljZdXC5lMrb0J4Lan7249eD5R5ILZ9Un 2MWHQbsSfC/eA== Received: from [10.0.0.5] ([184.64.102.149]) by cmsmtp with ESMTP id rsDjqxigcailArsDjqdwqv; Sun, 15 Oct 2023 03:55:16 +0000 X-Authority-Analysis: v=2.4 cv=M75elg8s c=1 sm=1 tr=0 ts=652b62a4 a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17 a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=84FUq1y3wrRBUFPjAbcA:9 a=QEXdDO2ut3YA:10 a=sRI3_1zDfAgwuvI8zelB:22 Message-ID: Date: Sat, 14 Oct 2023 21:55:15 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: cygwin@cygwin.com Subject: Re: Run a Cygwin process with "higher" scheduler priority Content-Language: en-CA To: cygwin@cygwin.com References: <6652d1ac-6ed9-824c-1bca-28ac49d01db7@cs.umass.edu> From: Brian Inglis Organization: Inglis Cc: Cedric Blancher In-Reply-To: <6652d1ac-6ed9-824c-1bca-28ac49d01db7@cs.umass.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfHkG5Hge0sQPppcGuKZRzkyb+TrkUoXpkkeqehCfgYpFFJbjQlCQVh7jB3jBAtjKV5XHuIDJc9bE8uUEyuKdIn3gz/BmfMKqtLxjPw3qp2+HIwy2kLFO s8hFaQ3j+LeihibU7vxPl0kzDAGU8xKJHC2vziRNB9b/PVSys9imGFTB9OEa7eIw124j8aMZi2ARnNp8qlAUHyBq4dMyAWbF6sPHb5pHAWwQkIkz+O2WgGDq X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-10-14 07:47, Eliot Moss via Cygwin wrote: > On 10/14/2023 7:39 AM, Cedric Blancher via Cygwin wrote: >> On Fri, 11 Aug 2023 at 19:14, Brian Inglis wrote: >>> On 2023-08-11 09:44, Cedric Blancher via Cygwin wrote: >>>> How can we set the scheduler priority for a Cygwin process to "higher" >>>> than normal on start? >>>> Basically we want a Cygwin compatible script version of the Windows >>>> task manager feature Name/PID--->Details--->Set priority--->Higher >>> Pretend the system is BSD or Linux and web search e.g. SO for that capability, >>> facility, or feature, then check Cygwin with Search Packages or: >>> $ cygcheck -p usr/bin/nice >>> Found 6 matches for usr/bin/nice >> I know about nice and renice, but I don't see whether it is working or not. >>> coreutils-debuginfo-8.26-2 - coreutils-debuginfo: Debug info for coreutils >>> ... >>> coreutils-9.0-1 - coreutils: GNU core utilities (includes fileutils, sh-utils >>> and textutils) >>> $ cygcheck -p usr/bin/renice >>> Found 6 matches for usr/bin/renice >>> util-linux-debuginfo-2.32.1-1 - util-linux-debuginfo: Debug info for util-linux >>> util-linux-debuginfo-2.33.1-1 - util-linux-debuginfo: Debug info for util-linux >>> util-linux-debuginfo-2.33.1-2 - util-linux-debuginfo: Debug info for util-linux >>> util-linux-2.32.1-1 - util-linux: Collection of basic system utilities >>> util-linux-2.33.1-1 - util-linux: Collection of basic system utilities >>> util-linux-2.33.1-2 - util-linux: Collection of basic system utilities >>> $ cygcheck -p usr/bin/chrt >>> Found 2 matches for usr/bin/chrt >>> util-linux-debuginfo-2.33.1-2 - util-linux-debuginfo: Debug info for util-linux >>> util-linux-2.33.1-2 - util-linux: Collection of basic system utilities >>> $ cygcheck -p usr/bin/taskset >>> Found 2 matches for usr/bin/taskset >>> util-linux-debuginfo-2.33.1-2 - util-linux-debuginfo: Debug info for util-linux >>> util-linux-2.33.1-2 - util-linux: Collection of basic system utilities >>> so you may need to install util-linux (coreutils is already installed as a base >>> package for Cygwin) then: >>>          $ man nice renice taskset chrt >> chrt does not work, the syscalls for realtime seem to be not implemented. >>> You may need to run these from an elevated admin shell for other user ids, >>> unowned processes, or higher (negative) priority. >>> It has been years since I tried these so can no longer remember if -20 >>> corresponds to Windows "RealTime" or if you need to use PowerShell to set >>> that e.g. >>>          $proc   = Get-Process -ProcessName "..." >>>          $proc.PriorityClass     = "RealTime" >>> and that needs to be done from an elevated admin (Power)Shell. >>> Of course, never set that on any system except on a very idle, very I/O bound, >>> well tested process, such as ntpd, that needs stably fast interrupt service and >>> non-preemptible cpu access for ms every few seconds, preferably on a single or >>> few cpus to which affinity is set. >> Is there anything in /proc which can tell me the current *Windows* >> scheduler priority level? Or a command line tool? > I recall getting taskset going in util-linux a while back, but I don't > recall working on priority related things.  You could look into the > cygwin source code to see how Windows priorities relate to the priority > values in Cygwin.  Then you may be able just to use /proc/[pid]/stat > read out what you want. ISTR testing nice/renice, and found it was a simple priority mapping to/from Unix to Windows Idle to RealTime (at the time, process Affinity was not supported, so went with a PowerShell startup script instead); see: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/sched.cc#l107 https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/sched.cc#l234 https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/sched.cc#l277 They are documented in proc(5) /proc/PID/stat fields 18 priority and 19 nice typically 20 and 0, as shown by `top` PR and NI, shown by `procps -l` as 80 and 0, and not shown by Cygwin `ps`. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry