Prev | Current Page 1363 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"


To use a subtler example, when faced with a problem that seems to require root privileges, such as
access to a sound card, the initial impulse is usually to run the program as root. However, there are
often user space solutions that can accomplish the same goal and that do not require root access. In
the case of writing programs that access a sound card, for example, the ALSA (Advanced Linux
Sound Architecture) libraries give application programmers access to a rich interface for emitting
squeaks and squawks without needing to rely on running a program as the root user.
Preemptive Multitasking
Perhaps the easiest way to express the preemptive multitasking characteristic of programming in a
Linux environment is simply to say that you don??™t own the CPU; it only seems as if you do.
In imprecise terms, the CPU (actually, the CPU scheduler, which is part of the kernel) allocates a
quantum of time (on the order of 50 milliseconds) to execute your program, then preempts it
(interrupts or suspends it) to spend another 50-millisecond quantum executing another program.
It then preempts the second program to execute the third, and so on until the scheduler returns to
your program, when (under normal circumstances) the round robin starts again.
The context switch between programs happens so rapidly that you have the illusion that your program
is running all the time.


Pages:
1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375