NEW AND EXCLUSIVE : GO TO THE ONLINE TEST PAGE AND TEST YOURSELF THROUGH EXAMINATION

What is Kernel level Threads ?

The identity of a Kernel level thread is known to the OS Kernel. A process creates threads in a way analogues to the create-process call.Let us call this create-thread call.One of the parameters of this call is the start address of thread in the code of creating process.The Karnel creates appropriate data structures for the new thread and assigns it an id.The call




returns with the id of the thread.The process creating the thread can use this id for synchronization purpose.The Kernel data structure for a thread would be a subset of the data structure for a process.A thread control block would be needed analogues to PCB fields which store resource allocation information would not be needed.The scheduler use the thread control block for the purpose of scheduling.The context switching actions are now of two kinds.The kernel would only save and load the CPU state while switching between threads of the same process.It would save and load the process environment if the thread being interrupted and the thread being scheduled to run belong to different processes.

    Kernel level threads can use all the privileges and facilities provided by processes themselves.Thusthey can make system calls to convey this resource and I/O requirements to the OS.

Difference with pure user level threads:

A kernel level thread (KLT) is a thread that the kernel is aware of, i.e. the kernel can decide which KLT will be schedule (assigned ot the CPU). Pure user level threads (PULTs) are not known to the kernel: One or more PULTs may run on top of a KLT and the kernel can only schedule the KLT. The decision which of the PULTs is scheduled is left to the user level scheduler in your application.
There are some tradeoffs between PULTs and KLTs and there are even hybrid models but the following problem remains: The kernel can only schedule KLTs to run on a given CPU. If you have more than one CPU/core then the kernel can schedule two KLTs to run concurrently.
For example you could decompress two JPEGs at the same time in your web browser if you have two cores on your CPU.

Ruby only offers PULTs. What does this mean? This means that you cannot have one Ruby process with two threads running at the same time. You cannot, for example, let a Rails process generate two differently sizted thumbnails of an uploaded image at the same time. You cannot answer more than one request at the same time without stopping the other thread. You cannot do numerical computations on more than one core at the same time.

Let me learn what you think :)