Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:09:03+00:00 2026-05-30T02:09:03+00:00

In the Linux real-time process priority range 1 to 99, it’s unclear to me

  • 0

In the Linux real-time process priority range 1 to 99, it’s unclear to me which is the highest priority, 1 or 99.

Section 7.2.2 of “Understanding the Linux Kernel” (O’Reilly) says 1 is the highest priority, which makes sense considering that normal processes have static priorities from 100 to 139, with 100 being the highest priority:

“Every real-time process is associated with a real-time priority, which is a value ranging from 1 (highest
priority) to 99 (lowest priority). “

On the other hand, the sched_setscheduler man page (RHEL 6.1) claims that 99 is the highest:

“Processes scheduled under one of the real-time policies (SCHED_FIFO, SCHED_RR)
have a sched_priority value in the range 1 (low) to 99 (high).”

Which is the highest real-time priority?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:09:04+00:00Added an answer on May 30, 2026 at 2:09 am

    I did an experiment to nail this down, as follows:

    • process1: RT priority = 40, CPU affinity = CPU 0. This process "spins" for 10 seconds so it won’t let any lower-priority process run on CPU 0.

    • process2: RT priority = 39, CPU affinity = CPU 0. This process prints a message to stdout every 0.5 second, sleeping in between. It prints out the elapsed time with each message.

    I’m running a 2.6.33 kernel with the PREEMPT_RT patch.

    To run the experiment, I run process2 in one window (as root) and then start process1 (as root) in another window. The result is process1 appears to preempt process2, not allowing it to run for a full 10 seconds.

    In a second experiment, I change process2’s RT priority to 41. In this case, process2 is not preempted by process1.

    This experiment shows that a larger RT priority value in sched_setscheduler() has a higher priority. This appears to contradict what Michael Foukarakis pointed out from sched.h, but actually it does not. In sched.c in the kernel source, we have:

    static void
    __setscheduler(struct rq *rq, struct task_struct *p, int policy, int prio)
    {
            BUG_ON(p->se.on_rq);
    
            p->policy = policy;
            p->rt_priority = prio;
            p->normal_prio = normal_prio(p);
            /* we are holding p->pi_lock already */
            p->prio = rt_mutex_getprio(p);
            if (rt_prio(p->prio))
                    p->sched_class = &rt_sched_class;
            else
                    p->sched_class = &fair_sched_class;
            set_load_weight(p);
    }
    

    rt_mutex_getprio(p) does the following:

    return task->normal_prio;
    

    While normal_prio() happens to do the following:

    prio = MAX_RT_PRIO-1 - p->rt_priority;  /* <===== notice! */
    ...
    return prio;
    

    In other words, we have (my own interpretation):

    p->prio = p->normal_prio = MAX_RT_PRIO - 1 - p->rt_priority
    

    Wow! That is confusing! To summarize:

    • With p->prio, a smaller value preempts a larger value.

    • With p->rt_priority, a larger value preempts a smaller value. This is the real-time priority set using sched_setscheduler().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If both standard and real-time signals are pending for a process, POSIX leaves it
It is possible to make real time intervals in not Real-Time Linux application in
I've been reading a paper on real-time systems using the Linux OS, and the
I am writing code for a real-time program running in an embedded Linux system.
I'm using a real time signal in Linux to be notified of the arrival
I heard and read that Windows/Linux OS machines are not real-time. I have read
I want to have a real-time process take over my computer. :) I've been
I am using the real time kernel embedded. In the kernel documentation it is
One of my favourite tools for linux is lsof - a real swiss army
Linux provides the stime(2) call to set the system time. However, while this will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.