Assigning the priority of services during the boot process

Linux provides the following choices for Process Scheduling:

  • SCHED_FIFO: Static Priority scheduling
  • SCHED_RR: round-robin variant of the SCHED_FIFO
  • SCHED_OTHER: default scheduling policy which uses the Completely Fair Scheduler (CFS)
  • SCHED_BATCH: for “batch” style execution of processes
  • SCHED_IDLE: for running very low priority background jobs

Usually to check and assign policies we use the chrt command, for example:

Checking Current policy of PID 1012:

# chrt -p 1012
pid 1012's current scheduling policy: SCHED_OTHER
pid 1012's current scheduling priority: 0

Assigning Policy FIFO with priority 50 to PID 1012:

#chrt -fifo -p 50 1-12 # chrt -p 1012
pid 1012's current scheduling policy: SCHED_FIFO
pid 1012's current scheduling priority: 50

 

But if we want a service to always have the same Scheduling policy, we may modify systemd service file as follows:

[Service]
....
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=50

Then reloading daemon  (systemctl daemon-reload) and restarting service will show our service with new scheduling.

 

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.