3

I'm trying to grasp the concept of an operating system at the moment (on Unix-like machines)

The kernel is the process with PID 0. Of course the Kernel is not really "just another process" because a process is a concept of the kernel, but it's not like the kernel yields control to some other component (...?).

Everything the kernel can do, can be looked up in the source code of the kernel (e.g. the Linux kernel is on Github for everybody to see)

So the operating system starts with the kernel as the active "process". It then yields a time slice to some other process (e.g. the process with PID 1), but at the same time assures, that it will give control back to the kernel.

So the control of the CPU is always: kernel -> some process -> kernel -> some process -> (...)

Never: some process -> some process

Systems calls are an API for userland processes to do some things the kernel is capable to do. All "advanced features" (accessing files, connecting to the web) of any program can be traced back to some system calls.

Do I have any grave misunderstanding?

1

1 Answer 1

5

Different types of UNIX have different architectures. In Linux and traditional monolithic UNIX systems the kernel is not a process. It's a block of code and data that is mapped into the memory space of every process (usually at addresses with the high bit set), but with a different I/O Privilege Level. When a process makes a system call, that triggers an interrupt, which switches the CPU into a higher privilege level and make the kernel code and data accessible until the interrupt returns. Processes like init (PID 1) and getty (started by init) are not the kernel, they're just ordinary user mode processes that are started automatically by the system.

Other UNIX systems, Mach for example, use a micro-kernel architecture, and have multiple subsystems running as separate processes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.