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?
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.
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.
Hope this helps.