samedi 4 juillet 2015

Which is more efficient? - A single thread and n broadcast recievers OR n independent threads

I have a scenario in which 'N' number of independent code snippets need to be run repeatedly in a constant interval. Which one of the following will be more efficient?

  1. One thread sending broadcasts repeatedly in a constant interval with N BroadcastRecievers registered for this action.

  2. N number of threads running independently and running the code repeatedly.

Or is there a better method?

Aucun commentaire:

Enregistrer un commentaire