On Tue, Nov 25, 2014 at 7:08 PM, Oleksii Bieliaiev <[email protected]
> wrote:

> Hey guys,
>
> let's imagine we have an app with a service and an activity inside. Both
> components live in a same process, our service is started (in terms of
> Android) and a user does some
>

it is called multithreading:
https://developer.android.com/training/multiple-threads/index.html


> interaction with an activity. Eventually our app goes to background. My
> question is, whether is it possible, under certain conditions (low memory,
> timeout, etc), that Android "kills" our started service separately, without
> killing entire process?
>

In general, you just have to analyze all the system call API available in
Linux, as syscall are the interface just before it gets transitioned to
kernel (java API-->C syscall-->kernel API).   And syscall are very well
documented.   For android, the list is perhaps here (for example):

https://github.com/android/platform_bionic/blob/master/libc/SYSCALLS.TXT

For interprocess/threads communication, kill() and tgkill() can be used.
So perhaps for your case, tgkill() can be used for sending signals from one
process to a specific thread in another process.

http://linux.die.net/man/2/tgkill

http://stackoverflow.com/questions/5374960/cant-compile-a-program-that-calls-tgkill
  ("no wrapper in glibc" is applicable to Linux, for Android, not sure if
bionic is provided, but if not, just use ARM assembly ("swi") to make the
syscall:
http://peterdn.com/post/e28098Hello-World!e28099-in-ARM-assembly.aspx




>
> Thank you,
> Alex
>
> --
> 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.
>



-- 
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.

Reply via email to