LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-25-2011, 07:36 AM   #1
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Rep: Reputation: Disabled
Kernel scheduler - Maximum Real time priority


Hi,

According to most material on the internet the kernel priority is from 0-139, where lower is higher in priority.

where RT tasks has 0-99 priority.
this gves me the idea that highest priority for RT is 0.
but kernel code defines MAX_RT_PRIO=100. this gives the idea that max RT priority is 99. ( since it normally uses MAX_RT_PRIO-1)

which one is correct?
What is the maximum priority for RT tasks. is it 0 or 99 ?

Thankx in advance,
reg13.
 
Old 07-25-2011, 02:38 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,737

Rep: Reputation: 154Reputation: 154
RT99 should be lowest priority.
 
Old 07-26-2011, 12:22 AM   #3
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
Higher real-time priority values correspond to a greater priority. So 99 refers to highest priority and 0 to lowest priority
 
Old 07-26-2011, 04:54 AM   #4
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by bsat View Post
Higher real-time priority values correspond to a greater priority. So 99 refers to highest priority and 0 to lowest priority
contradicting answers. I dont know which one is correct.
 
Old 07-26-2011, 02:09 PM   #5
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,737

Rep: Reputation: 154Reputation: 154
Quote:
Originally Posted by reg13 View Post
contradicting answers. I dont know which one is correct.
You can dig into code and then will know which value is higher priority.
 
Old 07-26-2011, 11:35 PM   #6
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
You can refer to the book
http://www.amazon.com/Linux-Kernel-D.../dp/0672329468

The chapter on process scheduling will give you the answer.
 
Old 07-27-2011, 01:06 AM   #7
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by nini09 View Post
You can dig into code and then will know which value is higher priority.
/linux/include/asm-generic/bitops/sched.h

Quote:
12 static inline int sched_find_first_bit(const unsigned long *b)
13 {
14 #if BITS_PER_LONG == 64
15 if (b[0])
16 return __ffs(b[0]);
17 return __ffs(b[1]) + 64;
18 #elif BITS_PER_LONG == 32
19 if (b[0])
20 return __ffs(b[0]);
21 if (b[1])
22 return __ffs(b[1]) + 32;
23 if (b[2])
24 return __ffs(b[2]) + 64;
25 return __ffs(b[3]) + 96;
26 #else
27 #error BITS_PER_LONG not defined
28 #endif
29 }


this starts bit search from byte 0 (b[0]), i.e. from bit 0 till bit 99.
and returns at the first bit found.
e.g. if bit 0 is set, it returns without going to bit 99.
thus, bit 0 or priority 0 is high. ( or is it ? )

Last edited by reg13; 07-27-2011 at 01:07 AM.
 
Old 07-27-2011, 02:49 PM   #8
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,737

Rep: Reputation: 154Reputation: 154
You can change scheduler policy to SCHED_FIFO. And then write a program to test it. We will know higher priority value is real lower or higher priority.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which value is for highest priority for real-time processes icoming Linux - Software 3 12-19-2009 10:30 PM
Hard/Soft Real Time Scheduler for Linux 2.4 amit_bst Linux - General 1 05-25-2006 06:44 AM
Hard/Soft Real Time Scheduler for Linux 2.4 amit_bst Linux - General 3 05-25-2006 04:14 AM
real time scheduler test lais Linux - Newbie 1 04-27-2006 08:08 PM
Scheduler for Real Time Tasks Scheduler Linux - General 2 04-14-2006 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration