What is the minimum round robin scheduing interval supported by linux?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What is the minimum round robin scheduing interval supported by linux?
Dear all,
For some reason, I want to have 10 processes share the same CPU core by affinity.
As you know, to achieve CPU sharing between processes, we can exploit the linux round robin (RR) scheduling policy by calling sched_setscheduler() to set the process's scheduling property.
For linux kernel 3.9 and later, we can set the RR scheduling interval by changing the file "/proc/sys/kernle/sched_rr_timeslice_ms". The default RR scheduling interval is 100ms. That is, all the 10 processes can be executed once every second.
My questions are
1) I want the RR scheduling interval to be 100us, i.e., each process is executed once every 1ms. But I failed to set the "/proc/sys/kernle/sched_rr_timeslice_ms" with a value of less than 1ms. I want to confirm if this is the truth. That is, the minimum RR scheduling interval supported by current linux kernel is 1ms.
2) Is anybody know what minimum scheduling interval is supported by Windriver linux? As Windriver linux is widely used for embeded system which requires good OS real-time performance.
3) I wonder if I can have all the 10 processes to be executed at least once within 1ms by using mutex. That is, one process executes for 100us, then unlock the mutex so that another process can lock and execute. Does this mechanism work?
4) If the above mentioned method doesn't work, what if the 10 processes are changed to 10 threads. Is there any high efficiency thread switch mechanism avaliable?
5) Does the function set_scheduler() only apply to process, but not thread?
1) I want the RR scheduling interval to be 100us, i.e., each process is executed once every 1ms. But I failed to set the "/proc/sys/kernle/sched_rr_timeslice_ms" with a value of less than 1ms. I want to confirm if this is the truth. That is, the minimum RR scheduling interval supported by current linux kernel is 1ms.
2) Is anybody know what minimum scheduling interval is supported by Windriver linux? As Windriver linux is widely used for embeded system which requires good OS real-time performance.
The lower limit of the scheduling interval is dependent on CPU speed. As you decrease the scheduling interval you increase the percentage of CPU time used to schedule. At some point decreasing the scheduling interval causes response time to deteriorate because too much time CPU time is being used by the scheduler.
Quote:
Originally Posted by cwang_sh
3) I wonder if I can have all the 10 processes to be executed at least once within 1ms by using mutex. That is, one process executes for 100us, then unlock the mutex so that another process can lock and execute. Does this mechanism work?
No. That method is counter productive. When a process is being executed it may go into a wait for I/O, timer, etc. Then the scheduler turns the CPU over to the next process in the scheduler queue which is ready to run. If all of the other processes in the scheduler queue are waiting on a mutex then none can be run if the current process goes into a wait.
Quote:
Originally Posted by cwang_sh
4) If the above mentioned method doesn't work, what if the 10 processes are changed to 10 threads.
It still won't work.
Quote:
Originally Posted by cwang_sh
5) Does the function set_scheduler() only apply to process, but not thread?
I don't know. After reading the set_scheduler() man page I think that the answer is yes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.