AsyncTask uses the thread pool method. Each AsyncTask you run enters the queue; in the "pool" (or they are created as necessary to a certain limit) there are several idle threads waiting for tasks. A simple thread from the pool takes your AsyncTask and executes it, and then returns to the pool. The process then repeats until there are more tasks in the queue.
This approach has two important functions:
- no overhead to create a stream every time
- in the case of a huge number of tasks, system performance deteriorates gracefully : most tasks will wait in line, and only a few of them will be performed at the same time; eventually they will all be fulfilled. Otherwise, if a separate thread was started for each task, the system would probably run out of memory or threads, or the tasks would end permanently.
The thread that you see in DDMS after AsyncTask shuts down is an idle thread in the pool.
source share