public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Cc: Cedric Blancher <cedric.blancher@gmail.com>
Subject: Re: Run a Cygwin process with "higher" scheduler priority
Date: Fri, 11 Aug 2023 11:14:51 -0600	[thread overview]
Message-ID: <cfbece04-40d6-566d-a4b8-f5334b1d453a@Shaw.ca> (raw)
In-Reply-To: <CALXu0UeiEH3gOYzwVjOqTgQ1OC8z=ZBOd4y4ky_-B0t5SrS9Pg@mail.gmail.com>

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

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.

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

  reply	other threads:[~2023-08-11 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 15:44 Cedric Blancher
2023-08-11 17:14 ` Brian Inglis [this message]
2023-10-14 11:39   ` Cedric Blancher
2023-10-14 13:47     ` Eliot Moss
2023-10-15  3:55       ` Brian Inglis
2023-10-15 13:04         ` Christian Franke
2023-10-14 22:52     ` Mark Geisert
2023-10-30  6:09     ` Chris Wagner
2023-10-30  7:43     ` Backwoods BC

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfbece04-40d6-566d-a4b8-f5334b1d453a@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cedric.blancher@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).