[plug] Kernel 2.4.10

Jason Nicholls jason at mindsocket.com.au
Tue Sep 25 12:09:34 WST 2001


On Tue, Sep 25, 2001 at 11:07:25AM +0800, Simon Scott wrote:
> 	Can anyone explain exactly what the 'preemptible patches' do?
> 
> 	Does it mean that the kernel cannot block a process from getting its
> fair share of CPU?

NOTE: please correct me if i'm wrong here, cause I'm no whiz at OS design or
the linux 2.4.x kernel...

Well to make things a little clearer, the linux kernel is preemptive already,
ie: it will switch tasks when the scheduler sees fit ensuring all processes
get their fair share of CPU time. BUT when a process is in a system call it
cannot be preempted. This patch adds kernel preemption. From the patch site:

	"It allows processes to be preempted even if in kernel mode"

Some text from my OS Concepts book by Silberschatz & Galvin may help:

	Preemption also has an effect on the design of the operating-system
	kernel. During the processing of a system call, the kernel may be busy
	with an activity on behalf of a process. Such activities may involve
	changing important kernel data (for instance, I/O queues). What
	happens if the process is preempted in the middle of these changes,
	and the kernel (or device driver) needds to read or modify the same
	structure? Chaos ensues. Some operating systems, including most
	versions of UNIX, deal with this problem by waiting either for a
	system call to complete, or for an I/O block to take place, before
	doing a context switch ... Undortunately, this kernel execution model
	is a poor one for supporting real-time computing and multiprocessing.

This is tied in with the spin-lock problem of earlier kernels. With the much
finer-grained locking in the 2.4 series kernels it's been possible to produce
this patch. Further on in the book regarding real-time scheduling:

	To keep dispatch latency low, we need to allow system calls to be
	preemptible. There are several ways to achieve this goal. One is to
	insert preemption points in long-duration system calls ...

[sorry for any typos]

Later,

Jason Nicholls
--------------------------------------------------------------------
Jason Nicholls    icq: 11745841    email: <jason at mindsocket.com.au>
Proprietor                        mobile: 0417 410 811
Mind Socket [web services]          http://www.mindsocket.com.au/
--------------------------------------------------------------------



More information about the plug mailing list