1. Download our Official Android App: Forums for Android!

Support What is the difference between Task and Process in Android?

Discussion in 'Android Help' started by bravoelf, Mar 23, 2016.

  1. bravoelf

    bravoelf Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    3
    Joined:
    Mar 23, 2016

    Mar 23, 2016
    3
    2
    6
    Hello everyone,

    Recently I've started to learn this topic and can't get what is the actual difference?

    I've read android dev pages and made a lot of googling.

    But people just make "copy-pasting" of some predefined definitions without actually answering the question (this includes Stack Exchange too). They try to explain how to use it but won't say what it is. ^_^

    I just want to know what the Task and Process terms means in a nutshell.
    Are they same?
    Or stuff like:
    Can a single task embrace multiple processes or just one? or maybe there is no relation between them at all? (the same questions applies vice versa)

    I'm a bit of confused and will glad to hear some "de facto" explanation or receive good references for some resources that explain this topic well.

    Thanks a lot in advance.
     

    Advertisement

  2. scary alien

    scary alien not really so scary
    Moderator
    Rank:
     #8
    Points:
    2,138
    Posts:
    22,298
    Joined:
    Mar 5, 2010

    Mar 5, 2010
    22,298
    23,695
    2,138
    Male
    space alien ;)
    Indy
    Welcome to our AndroidForums, @bravoelf :).

    I'm guessing that the difficulty you're having might be in the search terms you're using.

    If you're speaking of Linux itself, the terms are usually process and threads--when I saw your "task" reference, I internally translated that part to "thread". This page does a pretty good job of explaining the differences and nuances between a process and thread:


    From the above: a process:

    In a very basic form, Linux process can be visualized as running instance of a program.

    and a thread:

    Threads in Linux are nothing but a flow of execution of the process.

    i.e., threads are parts of processes.

    Also, in case you were really asking about the Android-specific parts of all of this, here are two pages that talk about the Android operating system and a good image of the software stack showing how a program (Android app) fits within the application framework and the supporting libraries and Linux kernel:


    Additionally, there is also the Android application lifecycle:

    Cheers and I hope that helps!

    :)
     
  3. bravoelf

    bravoelf Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    3
    Joined:
    Mar 23, 2016

    Mar 23, 2016
    3
    2
    6
    Hi scary alien ^_^ (sounds weird though)

    Thanks a lot for your response.

    It turns out that is one of these rare cases when I've should just to keep reading the guides ))))

    After I posted my question I found this pretty nice presentation:

    http://www.slideshare.net/JAX_London/android-android-activity-launch-modes-and-tasks-gonalo-silva

    That does explains things pretty well.

    Furthermore I'm familiar with concept of process and threads in Linux (I think this is what have caused my confusion with Android stuff).


    So for now I think I've got the picture of how things organized.

    As it picts out to me.

    When one starts some application, its components run (by default) within a single process, still this behavior can be overrided by providing suitable definitions to in xml files.

    Additionally there are launch modes which is responsible for creation of Task stack when some activity is started.

    By this (as far as I can understand).

    Task is logical organization of activities, yet it has a physical implementation which is Task stack, where all activities are being managed.

    So, in this way, Task may contain different activities, which in turn may run within different processes.

    On the other hand the Task itself (or actually its task stack) is being run within the process at which root Activity is running (by saying root activity, I mean the activity which has created the Task).

    Have I missed something?

    Again thanks a lot for your response.

    Sincerely,
     
    El Presidente and scary alien like this.
  4. scary alien

    scary alien not really so scary
    Moderator
    Rank:
     #8
    Points:
    2,138
    Posts:
    22,298
    Joined:
    Mar 5, 2010

    Mar 5, 2010
    22,298
    23,695
    2,138
    Male
    space alien ;)
    Indy
    Ah, yeah, it sounds like you were looking / asking about the Android application lifecycle.

    In addition to the link/site you gave in your last reply and the one I linked at the end of my first one, there are lots of other great helpful and illustrative images and websites that discuss and elaborate on that lifecycle topic.

    Cheers!

    :)
     

Share This Page

Loading...