You are not logged in.

#1 2014-04-26 09:57:43

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Soft-Realtime and Idle-Only scripts (BFS)

These handy scripts to make use of the -ck patchset's extra scheduling policies (soft realtime for music production, emulation gaming, video calling, etc. and forced idle-only to keep long-term and high-load tasks out of the way)

Both scripts can take a command with arguments, -b and a list of executables, or -p and a list of process ids.

Execute commands (or enhance running processes) with isosynchronous scheduling, the highest priority and the most favorable IO policy (almost realtime):
isosched

#!/bin/bash

case "${1}" in
  -p) #PID(s)
    shift
    for proc in "$@"; do
      schedtool -I -n -20 "$proc" &
      ionice -c 2 -n 0 -p "$proc" &
    done
  ;;
  -b) #Batch of tasks
    shift
    for proc in "$@"; do
      schedtool -I -n -20 -e ionice -c 2 -n 0 "$proc" &
    done
  ;;
  *) #Single task (with arguments)
    schedtool -I -n -20 -e ionice -c 2 -n 0 "$@" &
  ;;
esac

Execute commands (or limit running processes) with idle priority scheduling, the lowest priority and the least favorable IO policy (buried alive):
idleprio

#!/bin/bash

case "${1}" in
  -p) #PID(s)
    shift
    for proc in "$@"; do
      schedtool -D -n 20 "$proc" &
      ionice -c 3 -p "$proc" &
    done
  ;;
  -b) #Batch of tasks
    shift
    for proc in "$@"; do
      schedtool -D -n 20 -e ionice -c 3 "$proc" &
    done
  ;;
  *) #Single task (with arguments)
    schedtool -D -n 20 -e ionice -c 3 "$@" &
  ;;
esac

For example, make X near-realtime:

# isosched -p `pidof X`

Then start PCSX2 at near-realtime

$ isosched pcsx2

This should give you the maximum frame rate and best AV synchronization possible. Also works well for WINE programs.

Last edited by quequotion (2019-06-04 19:27:43)

Offline

#2 2014-04-26 14:35:37

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: Soft-Realtime and Idle-Only scripts (BFS)

Ordinary users are not allowed to increase priority by default (the policy seems designed for multi-user systems).
If you have administrative rights, replace "$USER" with your username and append the following line to control your own destiny:
/etc/security/limits.conf

$USER		-	nice		-20

Last edited by quequotion (2014-08-01 20:59:01)

Offline

Board footer

Powered by FluxBB