Old Linux tuning notes

Published (last updated )

pam_limits domains:

pam_limits types:

pam_limits items:

util-linux:

cfq io scheduler classes:

io scheduler types:

process sched_setscheduler types:

notes:

All limit settings are set per login. They are not global, nor are they permanent; existing only for the duration of a session.

A static priority value sched_priority is assigned to each process and this value can be changed only via system calls. Conceptually, the scheduler maintains a list of runnable processes for each possible sched_priority value, and sched_priority can have a value in the range 0 to 99. In order to determine the process that runs next, the Linux scheduler looks for the non-empty list with the highest static priority and takes the process at the head of this list. The scheduling policy determines for each process, where it will be inserted into the list of processes with equal static priority and how it will move inside this list.

A blocked high priority process waiting for the I/O has a certain response time before it is scheduled again.

Child processes inherit the scheduling algorithm and parameters across a fork(). The scheduling algorithm and parameters are preserved across execve(2).

As a non-blocking end-less loop in a process scheduled under SCHED_FIFO or SCHED_RR will block all processes with lower priority forever, a software developer should always keep available on the console a shell scheduled under a higher static priority than the tested application. This will allow an emergency kill of tested real-time applications that do not block or terminate as expected.

Standard Linux is not designed to support hard real-time applications, that is, applications in which deadlines (often much shorter than a second) must be guaranteed or the system will fail catastrophically. Like all general-purpose operating systems, Linux is designed to maxi- mize average case performance instead of worst case performance. Linux’s worst case performance for interrupt handling is much poorer than its average case, its various kernel locks (such as for SMP) pro- duce long maximum wait times, and many of its performance improvement techniques decrease average time by increasing worst-case time. For most situations, that’s what you want, but if you truly are developing a hard real-time application, consider using hard real-time extensions to Linux such as RTLinux or RTAI or use a different operating system designed specifically for hard real-time applications.

links: