Processes and the Kernel

Unix work is divided up into processes, which you can think of as tasks to be done. Each process has a unique process ID, which is simply an integer, and an owner, along with priority and many other attributes that you can see with the ps command. Unix is multiuser and multitasking, so many processes belonging to many users can be running concurrently. (NT, on the other hand, is multitasking, but not multiuser.) Of course, Unix processes are not all running at exactly the same time; it looks that way because the operating system is letting each process run for a bit of time, then interrupting it and letting the next one run, more or less in round robin fashion. The process that does the scheduling runs in the kernel and is known as the scheduler. Processes are scheduled in terms of " clock ticks,” which are hundredths of a second, so every process is allocated at least one one-hundredth of a second when it starts its turn.

The kernel is some address space and tasks that do scheduling and other fundamental functions, such as directly interfacing to the hardware to display something on-screen or to write something to disk. Only the kernel has direct access to the hardware, and the kernel is accessible to user programs only through the system calls that define its interface. This has a couple of benefits: the kernel can prevent user processes from doing naughty things with hardware, such as reading someone else’s files from disk. Also, the system calls can ...

Get Web Performance Tuning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.