I've noticed common thread regarding several issues about multithreaded kernel architecture, yet it seems to me most people don't have a real understanding of how it all works. When discussing preemptive, non-preemptive, single processor and multi processor configurations, you must understand these are actually separate issues. What I mean is, whether or not a kernel is preemptive has nothing at all to do with whether or not the computer has a single or multi processors.

Let me define some terms...

Multi-threaded ... an environment which can emulate the execution of multiple programs 'simultaneously' by allowing each program to run for specific periods of time. In single processor environments, the concept of multi-tasking is a farse. No two programs are ever executed at the same time in the CPU. By switching which program gets to run many times (millions) per second, it appears to us slow humans that everything is happening at the same time. It's not. It is also important to know that this holds for a single CPU within a multiple CPU system.

Pre-emptive kernel ... the concept of 'pre-emption' is one of many ways that a multi-threaded environment can handle which programs get to use the CPU, and when. Simple pre-emptive kernels switch amongst the currently running programs by 'interrupting' then switching to the next program that needs to run. When the interruption happens is based solely upon time. That is, the scheduler can switch the currently running program every X nanoseconds (known as a time-slice). If a program gets switched out, it is simply interrupted. The scheduler doesn't care whether the program finished or not. The scheduler just wants to make sure the next program gets to run. Complex pre-emptive kernels can introduce concepts such as prioritization into the scheduler.

Non-preemptive kernel ... In a simple non-preemptive kernel, the scheduler doesn't decide which program gets to run solely based on time. That is, the concept of the scheduler interrupting and switching to the next program does not exist. Instead, the scheduler will allow the currently running program to run to completion. When that program finishes, the scheduler allows the next program to run, which itself is allowed to run to completion (rinse and repeat). The overhead in a non-preemptive kernel is less than that of a preemptive kernel because the scheduler does not have to run many (millions) of times per second. It only has to run each time a program finishes. The drawback in this situation is that a single program can take up as much time as it needs to run to completion before the next program runs. While this program is running, it appears to the human that the machine isn't doing anything (hence, it feels 'laggy').

In any given system, each processor has a scheduler which can switch programs in and out of execution. In multiprocessor systems, this means several programs can be running on CPU A, while many _other_ programs are running on CPU B. Whether or not the schedulers on these CPU's is preemptive is dependent entirely upon the kernel configuration.

Bob Burrough
http://www.bobburrough.com/

On 12 Jul 2003 12:50:49 -0700, Mark Knecht <[EMAIL PROTECTED]> wrote:

On Sat, 2003-07-12 at 12:16, Daniel Robbins wrote:
On Sat, Jul 12, 2003 at 06:30:38PM +0100, Stroller wrote:
> > To compare performance, you should use similarly configured kernels.
> > Preempt decreases overall performance significantly but also increases
> > interactivity greatly. Things will benchmark slower with it enabled,
> > like you are experiencing.
> > I'm sorry - this is really dumb of me to ask: what is "increased
> interactivity" in this context..?

Lower latency with audio applications, smoother response in X, general
elimination of any "jerkiness" when the system is under heavy load.
Generally gives a much better experience when using Gentoo as a desktop
environment, or for multimedia apps. You may get slightly lower framerates
in games, but the game will be consistently smooth and you won't have audio
dropouts even under high load.

Best Regards,

Daniel, One sort of urban legend that's out there in the Linux audio community has to do with the value of a dual vs. single processor systems and how much they can help in this area.

The argument seems to go that on a DP machine one processor will
handle the GUI/OS/drivers and the second processor will handle the audio
application. However, no one (that I know of anyway) has really measured
this quantitatively and shown it to be true. (It might be to subjective
anyway...) Any thoughts?

My concern has generally been that every SMP machine I've looked at
(admittedly not that many) seems to be a generation behind in chipsets
and memory technology which goes against the goal. If I agree to pay
more money for a second processor I'd at least like the rest of the
machine to be equivalent technology.

I've never used a Linux SMP machine, so I have no idea how one tells
the system to run a certain app on a certain processor, but I can see it
should be possible I suppose.

Thanks for any thoughts you might have.

Cheers,
Mark


-- [EMAIL PROTECTED] mailing list





--
[EMAIL PROTECTED] mailing list



Reply via email to