answersLogoWhite

0

What is kernel thread?

Updated: 10/3/2023
User Avatar

Wiki User

11y ago

Best Answer

KERNEL

In computing, the kernel is the central component of most computer operating systems; it is a bridge between applications and the actual data processing done at the hardware level. The kernel's responsibilities include managing the system's resources (the communication between hardware and software components).

User Avatar

Cedrick Hirthe

Lvl 10
2y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is kernel thread?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What single task process requests from the kernel?

A thread.


Describe the action taken by a kernel to context switch between kernel level threads?

Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled.


A single task such as the task of printing a file that process request from the kernel?

Thread


What are the advantages and disadvantages of user level threads and kernel level threads?

- USER LEVEL THREADS Aadvantages: · User-level threads can be implemented on operating system that does not support threads. · Implementing user-level threads does not require modification of operating system where everything is managed by the thread library · Simple representation which the thread is represented by a the thread ID, program counter, register, stack , all stored in user process address space · Simple management where creating new threads, switching threads and synchronization between threads can be done without intervention of the kernel · Fast and efficient where switching thread is much more inexpensive compared to a system call - Disadvantages: · There is a lack of coordination between threads and operating system kernel. A process gets one time slice no matter it has 1 thread or 10000 threads within it. It is up to the thread itself to give up the control to other threads · If one thread made a blocking system call, the entire process can be blocked in the kernel, even if other threads in the same process are in the ready state KERNEL LEVEL THREAD: - Advantages: · Because kernel has the full knowledge of all the threads, scheduler may decide to allocate more time to a process having large number of threads than process having small number of thread, where the kernel threads come useful for intense application - Disadvantages: · Kernel level threads are slow and inefficient, since kernel must manage and schedule all the threads as well as the processes. It requires a full TCB for each thread to maintain information about threads, which results in increasing of overheads and kernel complexity


When a user-level thread executes a system call not only is that thread blocked but also all the threads within the process are blocked Why is that so?

A system call is actually a transition from user mode to kernel space to carry out a required operation.. For exp: Write() function resides in kernel space and can be accessed by a only corresponding wrapper function which was implemented in user space.. In case of Windows OS, Win32 API is the implementation to such as wrapper functions that make the actual system calls from user mode.. A kernel thread is created, scheduled and destroyed by the kernel.. Whereas a library thread (user thread) is created, scheduled and destroyed by a user level library like special threading libraries.. The kernel does know of nothing about library threads since they live in a process's boundaries and bound to its life cycle tightly.. Actually, a process is not the primary execution unit in all operating systems.. When a process is made by kernel, a new kernel thread is created and attached to that process in question.. So the library threads created in user mode by a user mode library must share the time slices given to the kernel thread by the scheduler arbitrarily during the lifetime of a process.. So a process actually has one kernel thread and all other library threads have to share the kernel thread's cycles.. Hence when a library thread makes a blocking call, all the threads within the process are blocked because as I said, actually process has only one kernel thread assigned to it and others try to make use of it.. So to prevent other threads from blocking, either you should use library threads that make use of kernel threads or you could just use the CreateThread() Win32 API system function for kernel threads but the synchronization mechanism must be provided by the programmer using events, signals, mutex, semaphore etc.. Sun, BSD Unix flavours, Windows etc follow the same threading architecture in their systems as POSIX standard.. However, a thread is a process in Linux.. That's why Linux is so powerful in server systems.. So the control is left to programmers to create a POSIX way of treading model by Clone(2) system call(s).. So address space and data etc can be shared by lightweight processes easily.. When a Linux kernel thread (child process) is crashed, it won't affect the rest of the threads belong to parent process.. This is just the opposite in other operating systems that a crashing thread will destroy all of the threads in the process.. NPTL is a great threading library that was implemented by using Linux clone(2) system call.. Linux also has another type of kernel thread only lives in kernel space that can be utilized by kernel code like modules.. User threads can't be run in parallel on the different CPUs because of this. However, they are portable.. Kernel threads can be scheduled by kernel to be run on a SMP system.. Hope this helps.. hsaq19@ TH Algan


What is the difference between Kernel and User level thread?

A kernel thread, sometimes called a LWP (Lightweight Process) is created and scheduled by the kernel. Kernel threads are often more expensive to create than user threads and the system calls to directly create kernel threads are very platform specific. A user thread is normally created by a threading library and scheduling is managed by the threading library itself (Which runs in user mode). All user threads belong to process that created them. The advantage of user threads is that they are portable. The major difference can be seen when using multiprocessor systems, user threads completely managed by the threading library can't be ran in parallel on the different CPUs, although this means they will run fine on uniprocessor systems. Since kernel threads use the kernel scheduler, different kernel threads can run on different CPUs. Many systems implement threading differently, A many-to-one threading model maps many user processes directly to one kernel thread, the kernel thread can be thought of as the main process. A one-to-one threading model maps each user thread directly to one kernel thread, this model allows parallel processing on the multiprocessor systems. Each kernel thread can be thought of as a VP (Virtual Process) which is managed by the scheduler.


If a process terminates will its thread also terminate?

yes, because if process is terminated then its related thread has no work. After completion of process the kernel generates a thread that will cancelled the thread in order to save the time and memory of CPU.


What are user level threads?

•No special support needed from the kernel (use any Unix) •Thread creation and context switch are fast (no syscall) •Defines its own thread model and scheduling policies


Is there one stack per process when user level threads are used?

In both kernel and User level they have one stack per thread


The actions taken by a kernel to context switch bet user levl thread?

When a context switch occurs, the kernel saves the context of the old process into its Program Control Block and loads the saved context of the new process scheduled to run.


Different types of threads in OS?

There are many different thread forms in use today. The most common are; BPV thread API thread profile gauge Thread profile gauge API 5b thread gauges API thread gauges Pipe thread gauges API Thread Gauge Manufacturer & Supplier Ring gauge use Pipe threader Acme thread Feeler gauge set Ring gauge set threaded pipe plug step gauge NPT thread gauge Tapered pipe thread


What is reentrant kernel?

A reentrant kernel enables processes to give away the CPU while in kernel mode ,not hindering other processes from also entering kernel mode. A typical use is IO wait. The processes wants to read a file..It calls a kernel function for this. Inside the kernel function,the disk controller is asked for the data . Getting the data will take some time & the function is blocked during that time. With an reentrant kernel,the scheduler will assign CPU to another process until an interrupt from disk controller indicates that the data is available and our thread can be resumed . This process can still access IO,like user input