Command-line tools to control [[Threads vs. Processes|process]] priorities. --- #### `renice` - CPU Scheduling Priority Used to change nice value of a process - how much [[CPU - Central Processing Unit|CPU]] time it gets compared to others. Range is$\text{nice} \in \{-20 \text{ (highest)}, \dots , 19 \text{ (lowest)}$ ```bash title=Examples renice -n 10 -p 1234 # Lower the priority (give less CPU) of process 1234 renice -n -5 -p 1234 # Increase the priority (give more CPU) of process 1234 (requires sudo) ``` --- #### `ionice` - I/O Scheduling Priority Sets read / write disk priority. **Classes**: - `realtime` (class 1) – highest priority, requires root - `best-effort` (class 2, default) – standard priority - `idle` (class 3) – only runs I/O when no other I/O is happening ```bash title=Examples ionice -c2 -n7 -p 1234 # Set best-effort class with low priority ionice -c3 -p 1234 # Set idle I/O priority (least disruptive) ionice -c1 -n0 -p 1234 # Set realtime I/O priority (most aggressive, needs sudo) ```