Apply CPU and I/O policies
apply_scheduler: Remove SCHED_ISO that is not available on musl
Fix build with imported c code when using zig 0.7.0
Use std.log.scoped to fix build with zig 0.7.0



You can also use your local clone with git send-email.


License Version Liberapay receiving

benice is a program that applies CPU and I/O policies on system processes. It uses a predefined set of rules that can be extended and customized.


  • Apply CPU scheduling policies
  • Apply CPU and I/O niceness value
  • Written in zig for efficency and safety
  • No system dependencies (does not use any system command)
  • Lightweight client/server architecture with fallback
  • No periodic process scanning

#Getting started


benice only depends on zig master version.

#Build && Install

$ make
$ sudo make install PREFIX=/usr



benice uses a client/server architecture. Therefore to properly work beniced daemon should be started. For security reasons (explained here), beniced needs to be run as root:

# beniced

benice can also work without the daemon, but it will need to read the rules each time. This can cause significant overhead when the number of rules to read is significant.

You can also use the provided systemd service to run beniced:

$ systemctl enable beniced
$ systemctl start beniced


benice can be used in two different ways:

  • by prepending benice before calling an executable
  • by creating symlinks in /usr/local/benice and prepend this directory to PATH

#Prepending benice executable

This is the easiest way that lets you apply benice rule to an executable. To run cat (provided that there is a rule for it), type:

$ benice cat [[args] ...]

This is the preferred method because this way benice can apply the rules to all supported processes on the system.

Run the following command to setup the symlinks in /usr/local/benice:

# benice-setup

benice installs by default a profile file in /etc/profile.d/ that prepend its directory to PATH. However, if you manually set this value in your .bashrc, you need to adjust it accordingly.


To set high I/O and CPU priorities, benice executable respectively needs CAP_SYS_ADMIN and CAP_SYS_NICE capabilities. These capabilities can only be set by the root user but benice executable does not require root privileges to be used and can potentially set high priorities to malicious processes. As a security reason, only users with root privileges can add rules. The daemon will listen on a low number port, so any non-root process cannot impersonate beniced.


Credits to @Nefelim4ag for its work on Ananicy.


benice is licensed under GPLv3.