In single-threaded applications, is this the one and only kernel thread thread?

From Wikipedia, he says:

A kernel thread is the β€œeasiest” kernel scheduling block. Each process has at least one kernel thread.

I found out that a process is a container that stores memory space, file descriptors, device descriptors, system resources, etc ... and the thread is the one that really gets the scheduled kernel.

So, in single-threaded applications, is this one thread (main thread, I think), kernel thread?

+4
source share
2 answers

I assume you are talking about this article: http://en.wikipedia.org/wiki/Kernel_thread

According to this article, in a single-threaded application, since you have only one thread by definition, it must be a kernel thread, otherwise it will not be assigned and will not start.

If there were several threads in the application, this will depend on how user-mode multithreading is implemented (kernel threads, fibers, etc.).

It is important to note that this will be a kernel thread running in user mode when the application code is executed (unless you make a system call). Any attempt to execute a protected instruction while working in user mode will result in an error, which will ultimately lead to the completion of the process.

So, the kernel thread here should not be confused with the supervisor / privilege mode and kernel code.

You can execute kernel code, but first you must go into the system call.

+1
source

No. In modern operating systems, applications and the kernel operate at different levels of processor protection (often called rings). For example, Intel processors have four levels of protection. The kernel code runs in Ring 0 (kernel mode) and is able to execute the most privileged processor instructions, while the application code runs in Ring 3 (user mode) and is not allowed to perform certain operations. See http://en.wikipedia.org/wiki/Ring_(computer_security)

+1
source

Source: https://habr.com/ru/post/1492109/


All Articles