Android Question Services are processes or threads?

Discussion in 'Android Questions' started by Alessandro71, Dec 17, 2017.

  1. Alessandro71

    Alessandro71 Member Licensed User

    if i start 2 different services from an app, will they spawn 2 different processes or are they just 2 threads?
    in other words:
    2 different service modules will run in parallel on a multicore cpu, or execution will serialized anyway?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Services are neither processes nor threads. The services code runs on the main thread.
     
  3. Alessandro71

    Alessandro71 Member Licensed User

    so, no parallel processing is possible between 2 services
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It depends on what you are trying to do. For example if you are accessing a database then you easily use the async methods and they will be executed in parallel.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice