X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 366603858C20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1697283667;
	bh=vYJIdyVod+XcmDDYEMECis/zAnOfeqyc8ZG6srCoR24=;
	h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=eYv2Xci63G5L3Fr71BQAC16IPUS0bRM5z5xhwJo+vHZOD+2naLSYtGjB17NT2+fNJ
	 hSxeFhbFye3Wa7XSj+NAyx2OYFt2VzT846UJolZWKimYxIRVA2zsY/CrureuD3g0aa
	 B3w0LE/yI8H1M7qDy+BXakC6ORgn7EssDkuG2RUI=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A6253858D20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697283630; cv=none;
 b=YxV5omAqxOHwlj4nWr3XIur009wPEQ/rr6YxxMqHIdEU2l8X98Txr3rGQBOlrA3RQAmtPj3aQBKFM2Sbnbf5ebRKFjg0x/P0FIUSF+gWF9WG6SS6TG8jF+NMJG7str18p8EL0XA1hfO1adMI65a01frqqoMzzppOr7gNB0UehbE=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1697283630; c=relaxed/simple;
 bh=xVKPqYE0hP6Kg06YqEzRgEACTpm0AhN3xZ7XK+b0wts=;
 h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
 b=l9gBJkFeme23kfK1T8LVZjKExWDjKsd4tLxyyppmcCBjC9vHC9RACbBsT54JHLKZYn+y++DWQvgZfPqHaLixn5nDzYsWLhY1lhkQt8WvD/LqIOLSkPWsfzAklVE+4gogp0CJMCQmcme9uEwZg7H/rYN+0l+tNQevxSGsQXX+1pY=
ARC-Authentication-Results: i=1; server2.sourceware.org
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A6253858D20
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1697283626; x=1697888426;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=ncNfzTHj/3L0EzDAwCbiWx8csXdgkAPFKlRXOIcG9MU=;
 b=HpAs4A3UmuDo+fIaFt+/AhsVnZvfaUDDipjEmcGgEM0hpxZEvccUaActpxsTi2jC8H
 ui1flhva7XTvCHdbFkL5TBFN4SbL4FeUJ9orILoUFXplgencU4Pw/kogh+BgUdYR+BhI
 P2PAFp1xj8XOiW4D2TsSfOqf+fkiC6yG29LJncgXrw5z7B+cJmmSzswoKCqDzEpcAWx7
 fcUeSQ7xhBy0rwwIlFPDx3qMXK3B9DcLcbnCwamIL3M3x9Fgaq7qG1ARphyp9q+tvczz
 xPWhOC4pDTKaVSaZU+m8zcq0tyCNLvESbWXB5tYSZJBBYGLq/+pXhUvr5rcxUROX53X2
 zTww==
X-Gm-Message-State: AOJu0YxOZNxeYg+8yDugaN/LxCLI0gmi5xuNikJNoErYZY9qJyhXUf0y
 zL9JZ1yOyDy/wvM8zCq2DGXAc/ghdS3Z875C2q1WaMYN
X-Google-Smtp-Source: AGHT+IFRJjfY5Q7uHbZXA/TA0h4mBUiAhMtKSsazoDUgXV8vSzm3+a9jjRAVS9prCJoXn5vsckuRtMRudcVcoOpGQkg=
X-Received: by 2002:a05:6512:132a:b0:503:1783:d5a9 with SMTP id
 x42-20020a056512132a00b005031783d5a9mr28667168lfu.3.1697283626465; Sat, 14
 Oct 2023 04:40:26 -0700 (PDT)
MIME-Version: 1.0
References: <CALXu0UeiEH3gOYzwVjOqTgQ1OC8z=ZBOd4y4ky_-B0t5SrS9Pg@mail.gmail.com>
 <cfbece04-40d6-566d-a4b8-f5334b1d453a@Shaw.ca>
In-Reply-To: <cfbece04-40d6-566d-a4b8-f5334b1d453a@Shaw.ca>
Date: Sat, 14 Oct 2023 13:39:50 +0200
Message-ID: <CALXu0Ufnz-uHKJfjDj3xShJR=w_Mwx8Xiw2qbRvJbxo=yqV_Uw@mail.gmail.com>
Subject: Re: Run a Cygwin process with "higher" scheduler priority
To: cygwin@cygwin.com
X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
 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@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Cedric Blancher via Cygwin <cygwin@cygwin.com>
Reply-To: Cedric Blancher <cedric.blancher@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

On Fri, 11 Aug 2023 at 19:14, Brian Inglis <Brian.Inglis@shaw.ca> 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?

Ced

-- 
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
