X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09D6A3857C4F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1697291276; bh=+IdVPaHH06rYJuR82/l2ZQrHkh5v03i40czcKe3DTzU=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YdKRJtN4pd5q1LRTn3iLZb6xd52wD/cJ77c2KEdPI/CTBrdcZ6fzLJunZkZayGGZ0 2fZ5Y5zWjqWQ+AWd40eQQoJqvRsZlPP56NwHL9mk4VEnWEh8gGpnhdvil6bTotATa+ TL/MeMCONiaZcDXxyrOJvaOoR2MKV8iKtO8+dCVo= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 70EDF3858C50 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 X-ASG-Debug-ID: 1697291238-24039d4bd7119dcf0001-w5GHUG X-Barracuda-Envelope-From: moss AT cs DOT umass DOT edu X-Barracuda-RBL-Trusted-Forwarder: 128.119.240.136 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 AT cygwin DOT com References: In-Reply-To: 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 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Eliot Moss via Cygwin Reply-To: Eliot Moss Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Cygwin" 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple