I'm reading OS Concepts for my undergrad OS class and came across this topic: Pthread scheduling (System and Process)

Then I kept reading and came across POSIX Real-Time Scheduling that has two scheduling classes:

SCHED_FIFO: first come first serve
SCHED_RR: round robin

Does this mean scheduling is different for real time computing or are they different levels of thread scheduling regardless of whether it is real time or not?

This is the POSIX API shown for real time scheduling:

pthread attr getschedpolicy(pthread attr t *attr, int
pthread attr setschedpolicy(pthread attr t *attr, int policy)

Edit: I think there is a different Linux real time kernel for which these APIs are applicable: https://www.embedded.com/comparing-real-time-scheduling-on-the-linux-kernel-and-an-rtos/

Can anyone confirm this is the case?

  • 1
    Both policies can be used for real-time programming. Whether FIFO or round robin is appropriate depends on the problem being solved. – James McLeod Dec 31 '19 at 23:58
  • so in Linux's case, process scope is unavailable so basically just set the schedule, is that correct? – mLstudent33 Jan 1 at 3:47
  • it has been ages since I used Pthreads. But I think it is more correct to say that while process scope is not available directly, we can still set certain attributes for it(like RR vs FIFO). I don’t understand the question in your comment, unfortunately, and I am having trouble relating it to your main question. – James McLeod Jan 1 at 3:56
  • I read the man pages and it said that only pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM); and not PTHREAD_SCOPE_PROCESS) is available in Linux. So basically scope cannot be changed but the scheduling policy can? – mLstudent33 Jan 1 at 4:15
  • Hypothetically, if I could change the scope, then I'm guessing that I could have different scheduling policies for each process. – mLstudent33 Jan 1 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.