Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Recently in an interview I was asked about the Scheduling algorithm used by Linux Operating system. What is the algorithm used any why?

Also, what algorithm is used in in real-time operating systems and why?

share|improve this question
    
For process or IO scheduling? Or even something else? –  maxschlepzig Sep 5 '11 at 19:50
add comment

3 Answers

The current Linux task scheduler is called Completely Fair Scheduler (CFS). You should have a look at http://people.redhat.com/mingo/cfs-scheduler/sched-design-CFS.txt for more details. The design is quite complex and in my view not suitable for RTOS.

A common technique in realtime systems is rate-monotonic scheduling, because it has strong guarantees if certain assumptions hold (e.g. static task priorities and fixed execution time and rate). There are a whole lot other algorithms and there has been a lot of research. So it's basically all about the properties you need and what you know about your task and what is fixed.

share|improve this answer
add comment

I'm not quite sure, whether you are taking about the I/O scheduling of the Kernel. In case you are not: Ignore this answer.

Wikipedia states, that the CFG (completely Fair Queuing) is default since Kernel 2.6.18.

On my openSUSE (running Kernel 2.6.37) I can switch between the CFG, NOOP and Deadline.

Hope this helps.

share|improve this answer
    
I'm curious,how can we switch to a different algorithm? Can you shed some light on this? thanks –  rsjethani Nov 3 '12 at 9:22
    
@rsjethani Go to YaST -> System -> Kernel Settings -> 2nd Tab (Kernel Settings) -> Global IO Scheduler. (naming of the options might be different as I've translated from a German GUI) –  Torbjoern Dec 18 '12 at 9:36
add comment

The Round Robin algorithm is generally used in time sharing environments.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.