LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 08-12-2014, 12:22 AM   #1
cwang_sh
LQ Newbie
 
Registered: Aug 2014
Posts: 5

Rep: Reputation: Disabled
Question 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?


Any responses will be highly appreciated.

Cheng
 
Old 08-12-2014, 08:12 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by cwang_sh View Post

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.
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 View Post

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 View Post

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 View Post

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.

http://linux.die.net/man/2/sched_setscheduler

-----------------------
Steve Stites

Last edited by jailbait; 08-12-2014 at 08:13 PM.
 
1 members found this post helpful.
  


Reply



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
round robin dns linuxengineer Linux - Networking 1 11-16-2010 03:54 AM
Round Robin with Squid marche Linux - Newbie 0 12-19-2008 10:00 AM
dns round-robin tzkolinux Linux - Networking 1 12-27-2004 03:49 AM
round robin for servers deepagodkhindi Programming 5 05-11-2003 05:50 AM
Round Robin DNS Lucsi Linux - Software 1 07-18-2002 04:17 AM

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

All times are GMT -5. The time now is 11:06 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
Open Source Consulting | Domain Registration