nice low priority Python in Windows and Linux

For data acquisition systems with high-priority data collection program, and other programs monitoring the status of the data collection, it’s important to prioritize these simultaneously running programs, even on modern computers with multiple cores.

Examples:

  1. main high priority program is running a high-speed high-resolution camera, dumping the data to disk.
  2. low priority program to read camera status, computing windowed average of N latest image frames.
  3. low priority intranet-only web-server program to provide image to external-facing webserver

Linux

cron starts the camera at a specific time for a specific length of time.

python camera.py

cron starts the monitor/server program, where the server is called within preview.py with subprocess.Popen.

nice -n 19 python preview.py
nice -n
run task(s) at priority, where bigger positive numbers are lower priority, and more negative numbers are higher priority.

Windows

Task Scheduler starts the camera at a specific time for a specific length of time.

python camera.py

Task Scheduler starts the monitor/server program, where the server is called within preview.py with subprocess.Popen.

start /low python preview.py
start /low
runs a program and its child processes at low priority.