On Fri, Dec 5, 2014 at 1:32 PM, Peter Teoh <[email protected]> wrote:
> > > On Fri, Dec 5, 2014 at 12:38 PM, TreKing <[email protected]> wrote: > >> >> On Thu, Dec 4, 2014 at 9:15 PM, Peter Teoh <[email protected]> >> wrote: >> >>> I am curious what API or method Android used to kill a specific thread >>> in a process too.....but your link above did not say anything on that? >>> Please enlighten me :-). >> >> >> I'm not sure what you're asking. The OP didn't ask anything about killing >> a specific thread. He question was about killing a Service without killing >> the entire hosting process. >> >> On Thu, Dec 4, 2014 at 9:44 PM, Peter Teoh <[email protected]> >> wrote: >> >>> a service is a thread in a process, >> >> >> What? No it's not. Where'd you get that? >> >> >> http://developer.android.com/reference/android/app/Service.html#WhatIsAService >> Second bullet point: "A Service is *not* a thread" >> > > well...you contradict yourself: same URL you quote: > > "Note that services, like other application objects, run in the main > thread of their hosting process." > > So, ok, service is not a thread, but the "main thread" is running the > service. And therefore, everything is still implemented as threads. > > See this: > > http://www.androidenea.com/2009/07/system-server-in-android.html > > And you can see that system_server process has many threads, each running > different services for Android. To quote: > > "We see that the power manager is started first, followed by the activity > manager and the other services. There are a lot more services started after > these initial and if you are interested take look in the SystemServer.java > file. Each service is running in a separate Dalvik thread in the > SystemServer process." > > see detailed picture here: > > > http://3.bp.blogspot.com/_fcXaF6gx74U/Skt-LUxMZSI/AAAAAAAAAB0/WsPol_qxwL4/s1600/SystemServer_threads.png > > BTW, if you see the process memory of "system_server" carefully here: https://tthtlc.wordpress.com/2011/02/04/what-is-this-system_server-inside-android/ you can also identify lots of "services" (implemented as differe jar files) loaded into the global piece of memory. In a process, all threads can see each other's memory, ie, they share the same virtual memory space. -- Regards, Peter Teoh -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

