foreground threads vs background threads foreground threads vs background threads multithreading multithreading

foreground threads vs background threads


Managed foreground/background threads, the Windows thread quantum and thread priority are orthogonal concepts.

  • Being a foreground thread means that the process cannot be stopped until it (and all other foreground threads) are stopped.
  • The quantum is the length of time a thread gets to run before the system will consider scheduling another thread on that processor.
  • The thread priority determines the pecking order within all ready to run, waiting threads.

Of these three items, only foreground/background pertains to managed code.

Now to your questions.

  1. The foreground process is a Windows concept. It is unrelated to foreground/background threads in .net.
  2. Thread priority does not affect the quantum.