From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barramail.cs.umass.edu (barramail.cs.umass.edu [128.119.240.3]) by sourceware.org (Postfix) with ESMTPS id 70EDF3858C50 for ; Sat, 14 Oct 2023 13:47:19 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 70EDF3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=128.119.240.3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697291240; cv=none; b=UJdBPFG6kzSMLz4l8XrsDA3HaZkmuWuD2qRuyQYUWGBd0BsxgkLUllGq/m2XFJeiFQ2vf46B1XR1JpC4AftFDLJ8HH9r8bljMMopq4cJp4z9vEDHpNAE0endkZg5im6N8UwKomax0245M1OnbLmB+pww6Q9r/eTRdWYRyIjEYcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697291240; c=relaxed/simple; bh=rbULy+G+wtGavUlSNE1T+VXpDtsKDg8AGRNIwKZPjoA=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=q6hywKpV0/8gUVPLWmHwFSdf2eWIXAPIMqgzAFMWNtB8gpOxntEp/Pjdz1zmdrH+p6v0B6jaZyomGmaKsLMQ/6Ob7jACUMzC4tl0VqcubVKB8GfYp8nTErjUy7VO4jqisd9Df2stqFdh4ZHSqkqeNrwhNaP4YqNphHFH6KTsmO8= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 70EDF3858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.umass.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.umass.edu X-ASG-Debug-ID: 1697291238-24039d4bd7119dcf0001-w5GHUG Received: from mailsrv.cs.umass.edu (mailsrv.cs.umass.edu [128.119.240.136]) by barramail.cs.umass.edu with ESMTP id 3FEXK4W7sI7xsWui (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sat, 14 Oct 2023 09:47:18 -0400 (EDT) X-Barracuda-Envelope-From: moss@cs.umass.edu X-Barracuda-RBL-Trusted-Forwarder: 128.119.240.136 Received: from [192.168.50.223] (c-24-62-201-179.hsd1.ma.comcast.net [24.62.201.179]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id C6007401CBD3; Sat, 14 Oct 2023 09:47:17 -0400 (EDT) Message-ID: <6652d1ac-6ed9-824c-1bca-28ac49d01db7@cs.umass.edu> X-Barracuda-RBL-Trusted-Forwarder: 192.168.50.223 Date: Sat, 14 Oct 2023 09:47:18 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Run a Cygwin process with "higher" scheduler priority Content-Language: en-US X-ASG-Orig-Subj: Re: Run a Cygwin process with "higher" scheduler priority To: Cedric Blancher , cygwin@cygwin.com References: From: Eliot Moss In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: mailsrv.cs.umass.edu[128.119.240.136] X-Barracuda-Start-Time: 1697291238 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://barramail.cs.umass.edu:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at cs.umass.edu X-Barracuda-Scan-Msg-Size: 3440 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.7 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.115383 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,NICE_REPLY_A,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 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. Best - EM