Best references:
1. Master from the Internet.
2. UNP V2 posix ipc chapter 12.
3. Linux man command.
Article 1: MMAP function Purpose
1. Map common files to the process memory space for memory ing Io.
2. Map special files to the process memory space for anonymous memory ing Io.
3. Map shm_open to open the POSIX shared memory zone to the memory space of the process, which can provide data sharing and IO among unrelated processes.
# Include
V
The video application can apply for a buffer from the v4l2 driver in two ways.
1. userptr, as the name implies, refers to the user space pointer. the application layer allocates the required memory space and passes it to the v4l2 driver layer as a pointer, the v4l2 driver saves the content of capture to the space indicated by the pointer.
In general, the application layer needs to ensure that the memory space is physically consecutive (the IPU processing unit is required), and the Android syst
Copy_to_user needs to check the validity of the pointer during each copy, that is, the pointer to the address of the user space is indeed the address of the process itself, instead of pointing to the location that does not belong to it, in addition, data is copied once each time, and memory is frequently accessed. Because the virtual address is continuous, the physical address may not necessarily be consecutive, resulting in frequent cache failures of the CPU, thus reducing the speed.MMAP only c
Dynamically passes the physical address and size of the kernel space to user space. This article also demonstrates two common methods that can be used for communication between kernel space and user space: Proc file system and Mmap shared memory.The entire kernel module, when the module inserts, establishes the proc file, allocates the memory. When the module is unloaded, the content written by the user space is printed.Here is the code for the kernel
Description
void *mmap (void *start,size_t length,int prot,int flags,int fd,off_t); Specific parameter meaningStart: Point to the memory start address to map, usually set to NULL, to allow the system to automatically select the address, and the mapping succeeds to return the address.Length: Represents how large portions of a file are mapped to memory.Prot: The protection method of the mapped area. There are several ways to combine the following:Prot_
Normal through the file system access to the value of Ain serial port, you can use Fread and other file IO read/sys/bus/iio/devices/iio:device0/in_voltage*_raw content.
But this requires high frequency access to the ADC is very inefficient, the data needs to be copied from the disk to the kernel process space, and then copied to the user process space, consuming unnecessary resources.
This problem can be solved by memory innuendo, Mmap can realize the
I. overview memory ing: in short, you can map a memory area of your space to the kernel space. After the ing is successful, your modifications to this memory area can be directly reflected in the kernel space. On the contrary, modifications made to
Recently in doing video output related things, for reserved for framebuffer memory use is not very clear, now find some information to tidy up, in case of use.For a system, there will be a lot of peripherals, then the management of these peripherals
Overview of Shared memory
The shared memory area is the fastest form of IPC, where data delivery is no longer related to the kernel, in other words, processes no longer pass data to each other by executing system calls into the kernel.
That is,
I. overview memory ing: in short, you can map a memory area of your space to the kernel space. after the ING is successful, your modifications to this memory area can be directly reflected in the kernel space. On the contrary, modifications made to
Ffi = require 'ffi' ffi. cdef [[ int open (const char * file, int flag); void * mmap (void * _ addr, int _ len, int _ prot, int _ flags, int _ fd, int _ offset); # pragma pack (1) typedef struct { char name [21]; unsigned short age;
Note: This example uses the form of shared file ing. The write end writes data and the read end reads data.
Write end:
/*-------------map_normalfile1.c-----------*/#include #include #include #include #include #include typedef struct{ char name[4];
Shared memory can be said to be the most useful interprocess communication and the fastest form of IPC because processes can read and write directly to memory without requiring any copy of the data. For communication like pipelines and Message
Preach Wisdom Blog Video tutorial Download summary |java video tutorial |net video tutorial |php video tutorial | Web video Tutorial
Preach Wisdom Blog Video tutorial Download summary |java video
Link to the PHP object-oriented programming getting started tutorial, and the OOP Getting Started Tutorial. Link to the PHP object-oriented programming getting started tutorial, the OOP Getting Started Tutorial PHP official learning oop: php. netmanuzhoop5.intro. php the following link Source: blog.snsgou.compost-41.ht
Destoon Introductory Tutorial example, Destoon Getting Started tutorial
Release time: 2014-06-23 Editor: www.jbxue.comCollect some Destoon introductory tutorials, Destoon examples, suitable for beginners to learn destoon basic tutorials and tips for getting started. Destoon Introductory Tutorials and tips examples
are Destoon basic tutorials, DESTOON®B2B website Management system is a set of Php+mysql-bas
Introduction to Public Platform development tutorial (graphic), Public introductory tutorial
Key word: Getting Started with public platform development
Author: C + + Lab
Background: The development of public platform requires a certain basic knowledge of PHP, PHP is an embedded HTML language, widely used in web development. There are two ways to transfer data between the server and the developer's server
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.