Android系统架构详解

Android系统架构详解

 

Android系统架构由5部分组成,分别是:Linux Kernel、Android Runtime、Libraries、Application Framework、Applications。

 

 

 

1、LinuxKernel : Android relies on Linux version 2.6 for core system services such assecurity, memory management, process management, network stack, and drivermodel. The kernel also acts as an abstraction layer between the hardware andthe rest of the software stack.  

 

Android基于Linux2.6提供核心系统服务,例如:安全、内存管理、进程管理、网络堆栈、驱动模型。LinuxKernel也作为硬件和软件之间的抽象层,它隐藏具体硬件细节而为上层提供统一的服务。 如果你学过计算机网络知道OSI/RM,就会知道分层的好处就是使用下层提供的服务而为上层提供统一的服务,屏蔽本层及以下层的差异,当本层及以下层发生了变化不会影响到上层。也就是说各层各尽其职,各层提供固定的SAP(ServiceAccess Point),专业点可以说是高内聚、低耦合。 如果你只是做应用开发,就不需要深入了解LinuxKernel层。  

 

2、AndroidRuntime : Android includes a set of core libraries that provides most of thefunctionality available in the core libraries of the Java programminglanguage.  

EveryAndroid application runs in its own process, with its own instance of theDalvik virtual machine. Dalvik has been written so that a device can runmultiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable(.dex) format which is optimized for minimal memory footprint. The VM isregister-based, and runs classes compiled by a Java language compiler that havebeen transformed into the .dex format by the included "dx" tool.

TheDalvik VM relies on the Linux kernel for underlying functionality such asthreading and low-level memory management.

 

Android包括一个核心库的集合,她们提供了Java编程语言的核心库中的绝大多数功能。

每一个Android应用都在她自己的进程中运行,该进程也属于某个Dalvik虚拟机的实例。Dalvik被设计成能让设备高效地运行多个虚拟机。Dalvik虚拟机执行的是.dex结尾的Dalvik可执行文件格式,该格式被优化为最小内存使用。虚拟机是基于寄存器的,并且运行那些Java编程语言所编译的类,这些类被内置的dx工具转换为.dex格式。

Dalvik虚拟机依赖Linux内核来提供底层的功能,比如线程和低级内存管理。

Android包含一个核心库的集合,提供大部分在Java编程语言核心类库中可用的功能。每一个Android应用程序是Dalvik虚拟机中的实例,运行在他们自己的进程中。Dalvik虚拟机设计成,在一个设备可以高效地运行多个虚拟机。Dalvik虚拟机可执行文件格式是.dex,dex格式是专为Dalvik设计的一种压缩格式,适合内存和处理器速度有限的系统。 大多数虚拟机包括JVM都是基于栈的,而Dalvik虚拟机则是基于寄存器的。两种架构各有优劣,一般而言,基于栈的机器需要更多指令,而基于寄存器的机器指令更大。dx 是一套工具,可以将 Java.class 转换成 .dex格式。一个dex文件通常会有多个.class。由于dex有时必须进行最佳化,会使文件大小增加1-4倍,以ODEX结尾。Dalvik虚拟机依赖于Linux内核提供基本功能,如线程和底层内存管理。

 

3、Libraries: Android includes a set of C/C++ libraries used by various components of theAndroid system. These capabilities are exposed to developers through theAndroid application framework. Some of the core libraries are listed below:

SystemC library - a BSD-derived implementation of the standard C system library(libc), tuned for embedded Linux-based devices.

MediaLibraries - based on PacketVideo's OpenCORE; the libraries support playback andrecording of many popular audio and video formats, as well as static imagefiles, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

SurfaceManager - manages access to the display subsystem and seamlessly composites 2Dand 3D graphic layers from multiple applications.

LibWebCore- a modern web browser engine which powers both the Android browser and anembeddable web view.

SGL- the underlying 2D graphics engine

3Dlibraries - an implementation based on OpenGL ES 1.0 APIs; the libraries useeither hardware 3D acceleration (where available) or the included, highlyoptimized 3D software rasterizer.

FreeType- bitmap and vector font rendering.

SQLite- a powerful and lightweight relational database engine available to allapplications.

 

Android包括了一个c/c++库的集合,她们被Android系统的众多组件所使用。通过Android的应用框架,这些功能被开放给开发者。其中的一些核心库如下:   

系统C库——一个继承自BSD的标准C系统实现(libc),被调整成面向基于linux的嵌入式设备。

媒体库——基于PacketVideo'sOpenCORE;该库支持许多流行音频/视频的录制与回放,当然还支持静态的图片文件,包括MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG

表面管理器——管理显示子系统,并能无缝地组合多个应用的2D和3D图像层。   

LibWebCore——一个流行的web浏览器引擎,她同时支持Android浏览器和嵌入式的web视图。

SGL——底层的2D图像引擎

3Dlibraries——基于OpenGLES 1.0 APIs的一个实现;该库或是使用硬件的3D加速,或是使用内置的高度优化的3D软件光栅。

FreeType—— 位图和矢量字体渲染

SQLite—— 一个强大而轻量的关系数据库引擎,对所有应用可用。

 

4、ApplicationFramework 应用框架   

Byproviding an open development platform, Android offers developers the abilityto build extremely rich and innovative applications. Developers are free totake advantage of the device hardware, access location information, runbackground services, set alarms, add notifications to the status bar, and much,much more.

Developershave full access to the same framework APIs used by the core applications. Theapplication architecture is designed to simplify the reuse of components; anyapplication can publish its capabilities and any other application may thenmake use of those capabilities (subject to security constraints enforced by theframework). This same mechanism allows components to be replaced by the user.

Underlyingall applications is a set of services and systems, including:  

Arich and extensible set of Views that can be used to build an application,including lists, grids, text boxes, buttons, and even an embeddable web browser

ContentProviders that enable applications to access data from other applications (suchas Contacts), or to share their own data

AResource Manager, providing access to non-code resources such as localizedstrings, graphics, and layout files

ANotification Manager that enables all applications to display custom alerts inthe status bar  

AnActivity Manager that manages the lifecycle of applications and provides acommon navigation backstack

 For more details and a walkthrough of an application, see the Notepad Tutorial.

 

通过提供一个开放的开发平台,Android提供给开发者建立极其丰富和创新应用的能力。开发者自由地享有硬件设备的优势,访问本地信息,运行后台服务,设置警示,向状态栏添加通知,还有更多……   

开发者能完全访问与核心应用所用的同一个框架APIs。应用架构被设计得能够简化组件的重用;任何应用都可以发布其功能,而其他的应用也就可以使用这些功能(安全限制主题由框架增强)。同样的机制允许用户替换组件。   

在所有的应用之下,有一系列的服务与系统,包括:   

丰富且可扩展的一系列视图Views,可用于建立应用;包括:lists,grids,textboxs, buttons,以及一个嵌入式的web浏览器。  

内容提供者,使应用能访问其他应用的数据(比如电话本),或是分享他们自己的数据。  

资源管理器,提供访问非代码资源的能力,比如本地化字符串,图形和布局文件。  

通知管理器,使所有的应用都能在状态栏显示自定义的通知。

活动管理器,管理应用的生命周期,并提供了一个通用的导航后台。     更多细节,和一个应用的演练,请看“记事本教程”。     

 

5、Applications 

Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language. 

Features 

  Application framework enabling reuse and replacement of components  

  Dalvik virtual machine optimized for mobile devices  

  Integrated browser based on the open source WebKit engine   

  Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional) 

  SQLite for structured data storage  

  Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)   

 GSM Telephony (hardware dependent)   

  Bluetooth, EDGE, 3G, and WiFi (hardware dependent) 

  Camera, GPS, compass, and accelerometer (hardware dependent)   

  Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE 

 

  Android装配一个核心应用程序集合,包括电子邮件客户端、SMS程序、日历、地图、浏览器、联系人和其他设置。所有应用程序都是用Java编程语言写的。更加丰富的应用程序有待我们去开发! 从上面我们知道Android的架构是分层的,非常清晰,分工很明确。Android本身是一套软件堆迭(Software Stack),或称为「软件迭层架构」,迭层主要分成三层:操作系统、中间件、应用程序。从上面我们也看到了开源的力量,一个个熟悉的开源软件在这里贡献了自己的一份力量。

特性 :

应用框架:使能重用和可替换的组件 

Dalvik虚拟机:为移动设备而优化 

集成浏览器:基于开源的WebKit引擎。 

优化的图形:自定义的2D图形库;基于OpenGL ES 1.0规范的3D图形(可选的硬件加速) 

SQLite:结构化的数据存储 

媒体支持:通用音频、视频,还有图像格式(MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)

GSM电话:(依赖硬件) 

蓝牙,EDGE,3G,和WiFi(需要硬件支持)

照相机,GPS,指南针和加速度计:(依赖硬件) 

丰富的开发环境:包括一个设备模拟器,调试工具,存储和性能简介,还有一个Eclipse IDE的插件。

深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值