java - Android Multi Threading -


how many java threads can run concurrently in android application ? think architecture dependent thing there way determine same ?

how many java threads can run concurrently in android application ?

that depends on definition of "run" , "concurrently".

you can start many threads want, subject memory limitations.

how many threads executing simultaneously depends on number of active cores on device.

i think architecture dependent thing

beyond architecture, depends on going on, android devices power down cores save battery power, whenever possible. plus, depending upon threads doing (e.g., blocking on i/o), having more threads cores reasonable.

a typical multi-core thread pool sizing algorithm use 2n+1 threads, n number of cores. asynctask uses approach, example:

private static final int cpu_count = runtime.getruntime().availableprocessors(); private static final int core_pool_size = cpu_count + 1; private static final int maximum_pool_size = cpu_count * 2 + 1; 

here, thread pool grow maximum_pool_size, twice number of cores (availableprocessors()) plus one.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -