Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 12. RHEL for Real Time scheduler


RHEL for Real Time uses the command line utilities help you to configure and monitor process configurations.

12.1. chrt utility for setting the scheduler

The chrt utility checks and adjusts scheduler policies and priorities. It can start new processes with the specified properties, or change the current properties of a running process.

The chrt utility takes the either --pid or the -p option to specify the process ID (PID).

The chrt utility takes the following policy options:

  • -f or --fifo: sets the schedule to SCHED_FIFO.
  • -o or --other: sets the schedule to SCHED_OTHER.
  • -r or --rr: sets schedule to SCHED_RR.
  • -d or --deadline: sets schedule to SCHED_DEADLINE.

The following example shows the attributes for a specified process.

# chrt -p 468
pid 468’s current scheduling policy: SCHED_FIFO
pid 468’s current scheduling priority: 85

12.2. Preemptive scheduling

Real-time preemption is the mechanism to temporarily interrupt an executing task, with the intention of resuming it later. It occurs when a higher priority process interrupts CPU usage. Preemption can negatively impact performance, and constant preemption can lead to thrashing, where processes are constantly preempted and no process ever runs completely. Changing task priority can help reduce involuntary preemption.

You can check for voluntary and involuntary preemption occurring on a single process by viewing the contents of the /proc/PID/status file, where PID is the process identifier.

The following example shows the preemption status of a process with PID 1000.

# grep voluntary /proc/1000/status
voluntary_ctxt_switches: 194529
nonvoluntary_ctxt_switches: 195338

12.3. Library functions for scheduler priority

The real-time processes use a different set of library calls to control policy and priority. The functions require the inclusion of the sched.h header file. The symbols SCHED_OTHER, SCHED_RR and SCHED_FIFO must also be defined in the sched.h header file.

The table lists the functions that set the policy and priority for the real-time scheduler.

Expand
Table 12.1. Library functions for real-time scheduler
FunctionsDescription

sched_getscheduler()

Retrieves the scheduler policy for a specific process identifier (PID)

sched_setscheduler()

Sets the scheduler policy and other parameters. This function requires three parameters: sched_setscheduler(pid_t pid, int policy, const struct sched_param *sp);

sched_getparam()

Retrieves the scheduling parameters of a scheduling policy.

sched_setparam()

Sets the parameters associated with a scheduling policy that has been already set and can be verified using the sched_getparam() function.

sched_get_priority_max()

Returns the maximum valid priority associated with the scheduling policy.

sched_get_priority_min()

Returns the minimum valid priority associated with the scheduling policy .

sched_rr_get_interval()

Displays the allocated timeslice for each process.

Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben