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.

example

  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

  1. cron starts the camera at a specific time for a specific length of time.
    python camera.py
    
  2. 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

  1. Task Scheduler starts the camera at a specific time for a specific length of time.
    python camera.py
    
  2. 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.

Categories:

Updated:

Leave a Comment