"Reading Notes" Android's ashmem mechanism learning

Source: Internet
Author: User

Ashmem is the driver module that Android has added on Linux, which means that Android does not have the functionality of Linux.

The Ashmem module is implemented at the kernel level and provides access interfaces at the runtime Library and application framework layer. At the runtime, the library layer provides a C + + interface, which is provided in the application framework layer as a Java interface.

  

First, starting from the analysis of the driver module, the driver module after loading first misc_register to register a ASHMEM_MISC device. This device file is "/dev/ashmem". This device provides four operations for the user layer open, mmap, release, IOCTL. But without the read and write operations, these two operations are implemented by MMAP.

    • Open (): essentially creates a ashmem_area struct that returns to the file structure

Here is an example of a function execution process that creates an anonymous shared memory file.

Application Layer Class: Memoryfile constructor--"JNI function: native_open--" Runtime: ashmem_create_region--"Ashmem driver interface function: Open, ioctl--" Ashmem-driven functions: Ashmem_open, Ashmem_ioctl

Note that the driver interface here is ashmem_open in the corresponding driver, the IOCTL is corresponding to the ashmem_ioctl. I personally feel a bit like the Windows-driven IRP main function code for the same as the distribution function, do not know that this understanding is not right 0.0, of course, the Windows Application layer is a fixed function (such as WriteFile, and then by the I/O manager operation), is not customizable.

"Reading Notes" Android's ashmem mechanism learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.