Linuxカーネルから紐解くAndroid

8,370 views

Published on

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
8,370
On SlideShare
0
From Embeds
0
Number of Embeds
338
Actions
Shares
0
Downloads
1
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • http://groups.google.com/group/android-developers/browse_thread/thread/705cdfde2aa20ce4/dc0e0e872de9b0d2?lnk=raot\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Linuxカーネルから紐解くAndroid

    1. 1. Linux Android 1
    2. 2. • • Web Android (?) •“ Android”• Android• twitter : @checkela 2
    3. 3. JAG 3
    4. 4. NDK• JNI • CPU architecture• NativeActivity• OpenGL|ES • Optimization (1.x,2.x) • NEON• OpenSL|ES• Sensor AndroidNDK 7/25 4
    5. 5. • Android Linux • Android Linux • Linux • Android ... http://www.androidproduction.com/ smartphones/the-tablets-can-be- used-in-honeycomb-mounted-with- linux.html 5
    6. 6. • Linux• Ubuntu• Android• Android Ubuntu• Android • ○○○ • ○○○ • ○○○ • ○○○• 6
    7. 7. http://www.flickr.com/photos/katclay/3934856523/( ) 7
    8. 8. Linux• Android • CPU • ( ) • GUI 8
    9. 9. • Linux• Ubuntu• Android• Android Ubuntu• Android • ○○○ • ○○○ • ○○○ • ○○○• 9
    10. 10. Ubuntu• Linux• Linux + GUI + + ...• PC Linux 10
    11. 11. • Linux• Ubuntu• Android• Android Ubuntu• Android • ○○○ • ○○○ • ○○○ • ○○○• 11
    12. 12. (1/3) 12
    13. 13. (2/3) 13
    14. 14. (3/3) 14
    15. 15. libraries Application FrameworkApplication Java JNI Linux Application Framework Linux API 15
    16. 16. • Linux• Ubuntu• Android• Android Ubuntu• Android • ○○○ • ○○○ • ○○○ • ○○○• 16
    17. 17. Android Ubuntu Android Ubuntu 2 1 OK PC 17
    18. 18. • Linux• Ubuntu• Android• Android Ubuntu• Android • ○○○ • ○○○ • ○○○ • ○○○• 18
    19. 19. Linux Ubuntu Android( ) Linux / 19
    20. 20. /•• Binder(IPC )••• ApplicationFramework ( logcat) http://elinux.org/Android_Kernel_Features 20
    21. 21. • Linux• Ubuntu• Android• Android Ubuntu• Android • • Binder • •• 21
    22. 22. • Linux• Ubuntu http://www.flickr.com/photos/ivanwalsh/4506526865/ 22
    23. 23. • • UID:GID • SandBox SandBox sa A B http://www.flickr.com/photos/katmere/117444001/ 23
    24. 24. • Linux• Ubuntu• Android• Android Ubuntu• Android • • Binder • •• 24
    25. 25. Binder• IPC(Internal Procedure Call) • • ls | sort -r• AIDL(Android Interface Definition Language), Intent• http://www.flickr.com/photos/mrvelocipede/501749557/ 25
    26. 26. BinderSandBox SandBox sa A B Intent Intent Intent AIDL AIDL Binder 26
    27. 27. • Linux• Ubuntu• Android• Android Ubuntu• Android • • Binder • •• 27
    28. 28. • Ubuntu • ...? 28
    29. 29. ( )• •• → CPU 29
    30. 30. wakelocks• Sleep ! • ) • (Java ) PowerManager pm = (PowerManager) getSystemService (Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = pm.newWakeLock(         pm.SCREEN_DIM_WAKE_LOCK, "My wakelook"); 30
    31. 31. • Linux• Ubuntu• Android• Android Ubuntu• Android • • Binder • •• 31
    32. 32. Android Ubuntu Linux 512MB 1GB 16GB(Xperia acro) +swap 32
    33. 33. (Android)• • ashmem(android shared memory) • pmem(Physical Memory Allocator)• • Out of Memory Handling • LowMemoryKiller 33
    34. 34. (Android)• • ashmem(android shared memory) • pmem(Processor Memory Allocator)• • Out of Memory Handling • LowMemoryKiller 34
    35. 35. • ?• Ubuntu • OutOfMemory Handling• Android • OutOfMemory Handling • LowMemoryKiller 35
    36. 36. Ubuntu• • OutOfMemoryHandling • kill• OOM • • Swap 36
    37. 37. Android• • (Ubuntu ) • swap 37
    38. 38. Android Ubuntu Linux 512MB 1GB 16GB(Xperia acro) +swap 38
    39. 39. •••• ... 39
    40. 40. LowMemoryKiller••• 40
    41. 41. • & • > > content provider •• ? • /init.rc 41
    42. 42. /init.rc ( ) # Define the oom_adj values for the classes of processes that can be # killed by the kernel. These are used in ActivityManagerService. setprop ro.FOREGROUND_APP_ADJ 0 setprop ro.VISIBLE_APP_ADJ 1 setprop ro.SECONDARY_SERVER_ADJ 2 setprop ro.BACKUP_APP_ADJ 2 setprop ro.HOME_APP_ADJ 4 setprop ro.HIDDEN_APP_MIN_ADJ 7 setprop ro.CONTENT_PROVIDER_ADJ 14 setprop ro.EMPTY_APP_ADJ 15 # Define the memory thresholds at which the above process classes will # be killed. These numbers are in pages (4k). setprop ro.FOREGROUND_APP_MEM 1536 setprop ro.VISIBLE_APP_MEM 2048 setprop ro.SECONDARY_SERVER_MEM 4096 setprop ro.BACKUP_APP_MEM 4096 setprop ro.HOME_APP_MEM 4096 setprop ro.HIDDEN_APP_MEM 5120 setprop ro.CONTENT_PROVIDER_MEM 5632 setprop ro.EMPTY_APP_MEM 6144 42
    43. 43. • Linux• Ubuntu• Android• Android Ubuntu• Android • • Binder • •• 43
    44. 44. • PC Android Linux • Android• • 44
    45. 45. • 45

    ×