1

Does a thread that is blocked cause the process to become blocked? Why and How? Thanks to all experts for answering.

Anonymous
  • 489
  • 1
  • 7
  • 18
  • 1
    A process can never be "blocked". It is an operating system object, a container for executable code and data. Code is executed by threads. If the thread that takes care of the user interface deadlocks or goes off the woods doing something else than taking care of the user interface then you'd be likely to conclude that the "process is blocked". – Hans Passant May 28 '16 at 00:14
  • 1
    The term we use for processes is typically "hung" rather than "blocked". A process can hang because all threads in the process are blocked, such as in a deadlock, but it can also hang because a thread gets into an infinite loop, or there is a more complex perpetual repetition involving multiple threads. – Warren Dew May 28 '16 at 01:03

2 Answers2

3

A process cannot be blocked because the concept of "blocked" only applies to a thread of execution. The only meaningful sense in which you could say that a process was blocked is if the process only had one thread and that thread was blocked.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
2

A thread is a flow of execution through the process code, with its own program counter, system registers and stack. A thread is also called a light weight process. Threads provide a way to improve application performance through parallelism. Threads represent a software approach to improving performance of operating system by reducing the overhead thread is equivalent to a classical process.

Each thread belongs to exactly one process and no thread can exist outside a process. Each thread represents a separate flow of control.Threads have been successfully used in implementing network servers and web server. They also provide a suitable foundation for parallel execution of applications on shared memory multiprocessors.

So, as you may have guessed, No ! A thread cannot block a process.

Vtik
  • 3,073
  • 2
  • 23
  • 38