Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whether Linux Kernel can be thought of as a single process

Whether Linux Kernel can be considered as a single process with many threads possible? Also what defines the switch between the memory management modules, scheduler, file system etc in the kernel.

like image 212
user567879 Avatar asked Jul 17 '13 14:07

user567879


People also ask

Does the kernel run as a process?

Yeah, the kernel executes before init (and the boot loader before that even). But a 'process' has a specific definition of: Runs in user space.

Is kernel single threaded?

The kernel maintains thread- and process-related information in two types of structures. A process is always created with one thread, called the initial thread. The initial thread provides compatibility with previous single-threaded processes.

What is Linux kernel process?

Basically the kernel virtualizes the common hardware resources of the computer to provide each process with its own virtual resources. This makes the process seem as it is the sole process running on the machine. The kernel is also responsible for preventing and mitigating conflicts between different processes.

Is the Linux kernel multi threaded?

Kernel can simultaneously schedule multiple threads from the same process on multiple processes. If one thread in a process is blocked, the Kernel can schedule another thread of the same process. Kernel routines themselves can be multithreaded.


1 Answers

Linux kernel can't be considered as a process, because this is one of its responsibilities to manage processes.

You can consider kernel as a big interrupt handler. After the kernel grants processor to the thread, the only way to get control back are interrupts (or system calls, which are also interrupts). When interrupt occurs, kernel immediately gets control, and appropriately handles interrupt. At this point various parts of kernel could be called.

Kernel is multi-threaded as it can handle various interrupts on different processors simultaneously. On the other hand, there are kernel-threads, which are managed in the same way as user threads (there is no difference between kernel and user threads for scheduler).

like image 106
Alexey Shmalko Avatar answered Nov 13 '22 21:11

Alexey Shmalko