Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zero Threaded Process?

Does a process have to have at least one thread in it? Is it possible for a process to be void of any threads, or does this not make sense?

like image 492
rrazd Avatar asked Oct 01 '11 22:10

rrazd


People also ask

Can a process have 0 threads?

A process can have zero or more single-threaded apartments and zero or one multithreaded apartment. Which implies that if both the number of single-threaded apartments and multithreaded apartments could be zero.

What are the four basic thread operations?

There are four basic thread management operations: thread creation, thread termination, thread join, and thread yield.

Does every process have at least one thread?

Threads exist within a process — every process has at least one. Threads share the process's resources, including memory and open files. This makes for efficient, but potentially problematic, communication. Multithreaded execution is an essential feature of the Java platform.

What is the minimum number of threads in a process?

A process is comprised of handles, threads and a memory space and a process can have multiple( 0 to n) threads. Thread is the smallest executable unit of a process. All threads of the same process share memory space of that process. One or more threads run in the context of the process.


2 Answers

A process usually has at least one thread. Wikipedia has the definition:

a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process.

The MSDN backs this up:

A processor executes threads, not processes, so each application has at least one process, and a process always has at least one thread of execution, known as the primary thread.

Though it does go on to say:

A process can have zero or more single-threaded apartments and zero or one multithreaded apartment.

Which implies that if both the number of single-threaded apartments and multithreaded apartments could be zero. However, the process wouldn't do much :)

like image 119
ChrisF Avatar answered Sep 29 '22 00:09

ChrisF


In Unix-like operating systems, it's possible to have a zombie process, where an entry still exists in the process table even though there are no (longer) any threads.

like image 31
Lorin Hochstein Avatar answered Sep 29 '22 01:09

Lorin Hochstein