'Android/개발정보'에 해당되는 글 2건

  1. 2010.09.07 Zygote 정보
  2. 2010.08.20 SQLite 함수모음
크리에이티브 커먼즈 라이선스
Creative Commons License

Zygote service가 하는 일

 

 A zygote (from Greek ζυγωτός zygōtos "joined" or "yoked", from ζυγοῦν zygoun "to join" or "to yoke"), [1] or zygocyte, is the initial cell formed when a new organism is produced by means of sexual reproduction.

 

 

출처: http://blog.chinaunix.net/u2/85805/showart_1421736.html

Zygote service does the following tasks step by step:

1. Create JAVA VM.

2. Register android native function for JAVA VM.

3. Call the main function in the JAVA class named com.android.internal.os.ZygoteInit whose

    source is frameworks/base/core/java/com/android/internal/os/ZygoteInit.java.

    a) Load ZygoteInit class

    b) Register zygote socket

    c) Load preload classes(the default file is frameworks/base/preloaded-classes)

    d) Load preload resources

    e) Call Zygote::forkSystemServer (implemented in  

       dalvik/vm/native/dalvik_system_Zygote.c) to fork a new process. In the new

       process, call the main function in the JAVA class named com.android.server.SystemServer,

       whose source is in frameworks/base/services/java/com/android/server.

         i.  Load libandroid_servers.so

         ii. Call JNI native init1 function implemented in frameworks/base/services/jni.

             It only calls system_init implemented in

             frameworks/base/cmds/system_server/library/system_init.cpp.

              - If running on simulator, instantiate AudioFlinger, MediaPlayerService and

                CameraService here.

              Call init2 function in JAVA class named com.android.server.SystemServer, whose

                source is in frameworks/base/services/java/com/android/server. This function is

                very critical for Android because it start all of Android JAVA services.

              - If not running on simulator, call IPCThreadState::self()->joinThreadPool() to enter

                into service dispatcher.

 

SystemServer::init2 will start a new thread to start all JAVA services as follows:

Core Services:

1.     Starting Power Manager

2.     Creating Activity Manager

3.     Starting Telephony Registry

4.     Starting Package Manager

5.     Set Activity Manager Service as System Process

6.     Starting Context Manager

7.     Starting System Context Providers

8.     Starting Battery Service

9.     Starting Alarm Manager

10.   Starting Sensor Service

11.   Starting Window Manager

12.   Starting Bluetooth Service

13.   Starting Mount Service

Other services

1.     Starting Status Bar Service

2.     Starting Hardware Service

3.     Starting NetStat Service

4.     Starting Connectivity Service

5.     Starting Notification Manager

6.     Starting DeviceStorageMonitor Service

7.     Starting Location Manager

8.     Starting Search Service

9.     Starting Clipboard Service

10.   Starting Checkin Service

11.   Starting Wallpaper Service

12.   Starting Audio Service

13.   Starting HeadsetObserver

14.   Starting AdbSettingsObserver

Finally SystemServer::init2 will call ActivityManagerService.systemReady to launch the first activity by senting Intent.CATEGORY_HOME intent.

 

There is another way to start system server, which is through a program named system_server whose source is frameworks/base/cmds/system_server/system_main.cpp. It also calls system_init to start system services. So there is a question: why does Android have two methods to start system services? My guess is that directly start system_server may have synchronous problem with zygote because system_server will call JNI to start SystemServer::init2, while at that time zygote may not start JAVA VM yet. So Android uses another method. After zygote is initialized, fork a new process to start system services. 

[출처] zygote service|작성자 베사메


저작자 표시
신고

'Android > 개발정보' 카테고리의 다른 글

Zygote 정보  (0) 2010.09.07
SQLite 함수모음  (0) 2010.08.20
document.write("");
Posted by 사우람
크리에이티브 커먼즈 라이선스
Creative Commons License
개발을 하다보니 오라클이나 MS_SQL과 달리 굉장한 제약이 많은 SQLite... 사실 쿼리땜에 골치 아팠는데
지원되는 함수도 없고... 그래서 피펏테이블과 비슷한 형태를 만들어야 했었는데 다행이 여기 함수보고 쉽게 해결!!

SQL As Understood By SQLite

[Top]

Aggregate Functions

The aggregate functions shown below are available by default. Additional aggregate functions written in C may be added using the sqlite3_create_function() API.

In any aggregate function that takes a single argument, that argument can be preceded by the keyword DISTINCT. In such cases, duplicate elements are filtered before being passed into the aggregate function. For example, the function "count(distinct X)" will return the number of distinct values of column X instead of the total number of non-null values in column X.

avg(X) The avg() function returns the average value of all non-NULL X within a group. String and BLOB values that do not look like numbers are interpreted as 0. The result of avg() is always a floating point value as long as at there is at least one non-NULL input even if all inputs are integers. The result of avg() is NULL if and only if there are no non-NULL inputs.
count(X)
count(*)
The count(X) function returns a count of the number of times that X is not NULL in a group. The count(*) function (with no arguments) returns the total number of rows in the group.
group_concat(X)
group_concat(X,Y)
The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then is is used as the separator between instances of X. A comma (",") is used as the separator if Y is omitted. The order of the concatenated elements is arbitrary.
max(X) The max() aggregate function returns the maximum value of all values in the group. The maximum value is the value that would be returned last in an ORDER BY on the same column. Aggregate max() returns NULL if and only if there are no non-NULL values in the group.
min(X) The min() aggregate function returns the minimum non-NULL value of all values in the group. The minimum value is the first non-NULL value that would appear in an ORDER BY of the column. Aggregate min() returns NULL if and only if there are no non-NULL values in the group.
sum(X)
total(X)
The sum() and total() aggregate functions return sum of all non-NULL values in the group. If there are no non-NULL input rows then sum() returns NULL but total() returns 0.0. NULL is not normally a helpful result for the sum of no rows but the SQL standard requires it and most other SQL database engines implement sum() that way so SQLite does it in the same way in order to be compatible. The non-standard total() function is provided as a convenient way to work around this design problem in the SQL language.

The result of total() is always a floating point value. The result of sum() is an integer value if all non-NULL inputs are integers. If any input to sum() is neither an integer or a NULL then sum() returns a floating point value which might be an approximation to the true sum.

Sum() will throw an "integer overflow" exception if all inputs are integers or NULL and an integer overflow occurs at any point during the computation. Total() never throws an integer overflow.

신고

'Android > 개발정보' 카테고리의 다른 글

Zygote 정보  (0) 2010.09.07
SQLite 함수모음  (0) 2010.08.20
document.write("");
Posted by 사우람
TAG SQLite


티스토리 툴바