Thread

Kernel-Level Thread

In a pure KLT facility, all of the work of thread management is done by the kernel. There is no thread management code in the application level, simply an application programming interface (API) to the kernel thread facility.

Advantages of KLT:

  • OS calls are blocking only the thread
  • Can schedule threads simultaneously on multiple processors: Concurrency support

Disadvantages:

  • Increased Kernel Overhead
  • Resource consumption:
    • Kernel-level threads consume system resources such as memory and CPU time, which can become significant in environments with a large number of threads or on resource-constrained systems.
  • Scheduling complexity
  • Limited portability

Quiz question:

You sell a single-process single-threaded application for a multi-processor system using a single-programming operating system with kernel-level threading and concurrency support using binary semaphores. Your CTO claims that migrating your highly parallelizeable, mixed IO&CPU-use application to multiple threads will make the application run at least 20% faster on the same hardware. Provide exactly one technically-founded argument related to material covered in this course whether this is or is not believable.

  • Since we are using multiple threads, then we will have a single-process multiple-threaded application, therefore in this one application that has a single process, it could run multiple threads which will make it faster. The reason being it does not have to switch between processes and pass through the kernel. Threads could switch between each other without involving the kernel. Thus, improving speed.
    1. Reduced Kernel Involvement: When a single-process multiple-threaded application is running, the threads within the same process share the same address space and resources. This means they can communicate and synchronize more efficiently compared to multiple processes, which would require inter-process communication mechanisms and involve the kernel for context switching.
  1. Efficient Thread Switching: Since threads within the same process can switch between each other without involving the kernel, the overhead associated with process context switching is significantly reduced. This can lead to faster thread context switches, allowing the application to utilize CPU resources more efficiently.
  2. Improved CPU Utilization: With multiple threads executing within the same process, the CPU can potentially achieve better utilization by keeping the cores busy with parallel tasks. This can lead to increased throughput and faster overall execution times for the application.