I want to know if there is a maximum number of threads that it is possible to run on an Android device. It depends on the type of the device?
-
3Technically there is no limit, but at some point having more threads is going to be less efficient than having less. If you want to see a pretty much optimal implementation of a `ThreadPool` look at the source code of the `AsyncTask`. – Xaver Kapeller Feb 01 '16 at 17:13
-
Lol are you asking for FTC? – Ankit Oct 11 '20 at 04:04
2 Answers
As commented by @Xaver Kapeller, you may create as many Thread
s you want but more thread
not actually the part of the solution.
A core
(CPU) in Processor
will handle only one Task
(Process
or Thread
) at a given time.
so in Processor
with 1 core will handle one thread
at a time. so technically no matter how many threads you open for this processor
it will serve a thread at a given time. All threads
which are running would be using processor sequentially, utilizing quantum time of processor which only seems to be concurrent.
Processor
with 2 core will handle 2 threads
at a time( concurrent execution of two threads).
Processor
with 4 core
will handle 4 threads at a time( concurrent execution of four threads.
Processor
with 8 core will handle 8 threads
at a time( concurrent execution of eight threads. so on

- 4,529
- 3
- 20
- 30
-
2For IO bound operations running more threads than cores is still beneficial because most of them can do the waiting in parallel. – drakorg May 21 '20 at 23:04
Maximum number of threads possible to run on an Android device depends on whether the device has a 32-bit processor or a 64-bit processor and stack size of Android. But you will have memory constraints way before you reach the actual maximum limit.
As mentioned in the article here you can run tests to determine maximum number of threads you can create in your Android version.