Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 800 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
::Android Framework:: Which is first runner, zygote or dalvik?

#1
I have a question involving the Android framework.

Every boot sequence shown on the Internet or in books shows the flow starting from zygote to dalvik as follows.

![Android Boot Sequence Image][1]

However, according to my code research, init processor runs `app_process(app_main.cpp)` before loading zygote like this :

[init.rc] :

service zygote **/system/bin/app_process** -Xzygote /system/bin --zygote --start-system-server

Because `zygote(ZygoteInit.java)` is java file(a kind of class), it needs the dalvik virtual machine to be executed so `app_process(app_main.cpp)` initializes dalvik machine and makes it ready for start.

And then loads `ZygoteInit.java` via dalvik.

Thus, zygote actually run.

It seems to me that the process which initializes and loads dalvik is not zygote but app_process and zygote is under dalvik because it is composed of java code.

**The only thing that makes me doubt this is some code in app_main.cpp.**

Watching `main` function in `app_main.cpp` file, you can find some lines as below :

[app_main.cpp] :

if (niceName && *niceName) {

setArgv0(argv0, niceName);

**set_process_name(niceName);**

}

`niceName` is pointing to the string `"zygote"`.

That means `app_process` is changed to zygote process using the `set_process_name()` function. If it is true, everything is OK. But I don't know what the fact is.

Anyone make me sure of what is first.

***Try to browse android code in :***

[To see links please register here]



[1]:
Reply

#2
Dalvik is shipped on Android as a loadable library. `app_process` links with that library, and uses it. As such `app_process` starts a Dalvik VM within its own process.

The Zygote is just a special case of this.

So, to more directly answer your question: During a typical start-up, the first Dalvik VM to run is one that is spawned within an `app_process` process, and it is passed arguments which cause it to become the Zygote process of the running system.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through