Kraken
Kraken

Reputation: 24233

Multithreads on kernel

In Galvin, I came across

Finally, many operating system kernels are now multithreaded; several threads operate in the kernel, and each thread performs a specific task.

Question 1

It does not imply that all of them will run at the same time, since at a given time only 1 process/thread can acquire control over the processor right? Though they could be doing various work, like one on CPU, other working on I/O like getting key strokes in the buffer etc., right?

Question 2

Multithreading will show better performance on multiprocessor systems only right?

Upvotes: 0

Views: 157

Answers (1)

Mohsen Afshin
Mohsen Afshin

Reputation: 13436

Answer 1: Every core of your CPU can execute one command at any given time. Since nearly all of modern CPUs are multi core you'll get better performance if your app is multithreaded.

Answer 2:Multithreading will show better performance in most of the cases even on systems with single core CPUs. Your app will become more responsive to user input if you dispatch your time intensive jobs to multiple threads

The parallelization levels are as below:

  1. Mutli Computers
  2. Multi Processors
  3. Multi Cores
  4. Multi Threads

At higher levels you see more benefit from threading. E.g your multithreaded app will run better in multi cores CPUs in compare with single core(multi threaded) CPUs

Upvotes: 3

Related Questions