The Linux distillery
Bringing the world of Linux to you, David cuts through the tech and shows you how it works and how to use it, in terms that apply to any distro. RSS
IT NEWS     Energy      iTWire Technology Feature - Virtualisation
Technology news and Jobs arrow The Linux distillery arrow The nuts and bolts of the Linux process scheduler
The nuts and bolts of the Linux process scheduler PDF E-mail
User Rating: / 11
PoorBest 
by David M Williams   
Monday, 18 February 2008
One distinction between the genders, allegedly, is the ability to multitask. Now, depending on who you speak to either women possess this or men do but I’m not bold enough to join that debate. What I can tell you, however, is that Linux definitely does. And, in fact, many systems may not be taking full advantage of it. Here’s why.

Back in days of yore, desktop computers did not multitask. They ran one dedicated task at a time. These days are past; even the most modest of embedded operating systems is generally capable of multitasking in some way.

Multitasking isn’t simple to implement for an operating system developer. It’s simple enough to explain – the CPU’s time must be divided between all the different tasks. Yet, there’s a whole heap more to it than this. Some processes are more important than others and must run regularly. Others are less important and can sit idling in the background. And should you let programs decide when to relinquish control back to the operating system for someone else, or should the OS make these decisions giving each task a specified amount of time to run before suspending it?

The part of Linux that looks after all this is known as the scheduler and the truth is that the scheduler offers a number of different algorithms to handle multitasking. No single algorithm is perfect for each and every occasion; a general purpose Linux server used by loads of interactive users may need a different means of handling time sharing than a dedicated web server for example. The Linux kernel actually allows the user to select at boot time which type of scheduling approach should be used. This is not widely appreciated and as a result many Linux systems may in fact be scheduling in a way which is sub-optimal for its purposes.

In actual fact, the scheduler is not really a separate process on its own but is executed by every process. Whenever any running process goes to sleep or has to block waiting for input or output it calls scheduler routines to figure out if it should switch control to another task, and if so, which one. This doesn’t happen because application developers tell it to, but because these scheduler calls are embedded within system calls within the Linux kernel itself.

Any process which is regularly communicating with devices – like disks and keyboards – will spend a lot of time waiting because the CPU is much faster than any input or output (I/O) device. This idle time is much better spent letting some other process run. By contrast, a mathematical complex program might spend large amounts of time just crunching numbers without any I/O activity.

There’s two ways the operating system can proceed: it might let the processes relinquish control whenever they are stuck waiting for something. This is called co-operative multitasking. Or, the OS might take control and force processes to give up for a while so another can run. This latter case is more suitable for the computationally intense example and is known as pre-emptive multitasking.

Linux uses both co-operating and pre-emptive multitasking. If a process doesn’t voluntarily hand control back on a regular basis it will be pre-empted.

Please read on for how this works.

CONTINUED







 
< Next story in category   Previous story in the category >
iTWire Technology feature

Virtualisation

dollsmaximise your infrastructure, maximise your business

Read more...



Search the web
Search iTWire

 
You don't need to login to post a comment





Lost Password?
No account yet? Register
Subscribe to our free daily newsletter.
Business Innovation Forum
July 24 (8:00 am) - July 25 (1:30 pm), 2008
Business Innovation Forum: a morning of innovative thinking that will help you gain business resu...

Broadband 2008
July 24 (8:45 am) - July 25 (11:59 pm), 2008
Broadband Australia 2008 The original forum for debating the future of Australia’s broadband i...

The Rapidly Emerging Mobile Media Market
July 24, 2008 (All Day)
Mobile media is the way of the future, and by 2015, it is expected that it will be the major reve...

Start Mid Year Technical Communication at Swinburne University
July 25 (9:00 am) - July 30 (11:59 pm), 2008
Last week to apply for Swinburne University’s online postgraduate Technical Communication courses...

Lean Six Sigma Black Belt Certification Workshop
July 25 (9:00 am) - July 27 (11:59 pm), 2008
eXample Consulting Group is conducting an immensely practical LEAN SIX SIGMA BLACK BELT TRAINING ...

Usability Fundamentals Training Course [Sydney]
July 28 (9:00 am) - July 29 (11:59 pm), 2008
The success of your website is inextricably linked to how well-versed those involved in the devel...

SAUG Summit 2008
July 29 (8:30 am) - July 31 (11:59 pm), 2008
The SAP Australian User Group (SAUG) "The Next Step..." Where do we go from here?...

ISEB ISTQB Foundation Certificate in Software Testing - Melbourne
July 29 (9:00 am) - July 31 (11:59 pm), 2008
This is the first internationallly accepted industry accreditation for software testing. It has b...

Open Publish Conference
July 30 (9:00 am) - July 31 (11:59 pm), 2008
Open Publish 2008 will be focusing on management and implementation issues relating to publishing...

Web 3.0: Mobile & the Semantic Web
July 30, 2008 (9:30 am - 12:00 pm)
part 2 of the 4 part semantic web forum series Speakers: - Jennifer Wilson, Principal, Lean F...
New event listings
SolidWorks Innovation Day (Melbourne and Adelaide)
October 17, 2008 (All Day)
Hosted by Intercad, SolidWorks’ Innovation Days will give designers, engineers and manufacturers ...

SolidWorks Innovation Day (Sydney)
October 16, 2008 (All Day)
Hosted by Intercad, SolidWorks’ Innovation Days will give designers, engineers and manufacturers ...

SolidWorks Innovation Day (Brisbane and Perth)
October 15, 2008 (All Day)
Hosted by Intercad, SolidWorks’ Innovation Days will give designers, engineers and manufacturers ...

LIXI Industry Forum 2008
September 10, 2008 (All Day)
Wednesday, 10 September 2008 The Westin Sydney The second annual major industry event for the...

Mobile Feast!
August 22, 2008 (All Day)
Join us as we discuss all things mobile! The history of technology tells us that the true inno...

The Business of Digital Content - Melbourne
August 5, 2008 (All Day)
The Business of Digital Content Melbourne – August 5, 2008 Extract maximum value from your...

View Full Calendar
Subscribe to our free daily e-newsletter
Contact , Register , Advertise with iTWire , Links , About iTWire , Feedback , Post your jobs , Events , iTWire site map , Start Blogging , MyBlogLog page
Industry Releases , Submit your release now