|
At the heart of UNIX is a relatively small program called the Kernel. The
kernel is a program that starts when the system boots, and remains active
while the system is running; it is the operating system. There is no direct
interface to the kernel, users don't run the kernel program
The kernel is responsible for the system resources and acts as
an interface between other programs and the hardware. It has the duty of
managing memory, disks, networking, scheduling and execution of programs,
and user access to files and resources. Programs themselves do not directly
manipulate these resources, instead they make requests for the kernel to
do it, known as system calls. As an example we will use a seemingly simple
task, such as displaying the contents of a file: cat file
Several system calls are made here:
-
a call to open(2) to open the file for reading
-
a call to open(2) to open stdout to write the output
-
calls to read(2) to get the contents of the file
-
calls to write(2) to output the contents of the file to stdout
-
a call to close(2) to close the file
All of the actions of open, read, and write are performed by the kernel.
This is how UNIX maintains its security. When a user tries to read a
file, a call must be made to open. When this call is made, the kernel checks
the permissions for the file, and grants the open request only if the user
has the appropriate access.
|