mmap

Discover mmap, include the articles, news, trends, analysis and practical advice about mmap on alibabacloud.com

Why is GNU grep so fast?

grep several times. To find line breaks, you need to view each byte. Instead, GNU grep does not use row-based input. Instead, it directly reads the input into a large buffer and then uses Boyer-Moore to search for the buffer, and only after it finds a match will it find the most recent line break (if you use the-n option, the optimization will be ineffective ). Finally, when I was still maintaining GNU grep (that was 15 years ago), GNU grep tried some very difficult things, such as using

Optimization of iOS image loading speed limit-FastImageCache resolution

Optimization of iOS image loading speed limit-FastImageCache resolution FastImageCache is an open-source library developed by the Path team to accelerate image loading and rendering, so that the image-based list slides more smoothly to see how it works.Optimization points IOS loads an image from the disk and uses UIImageVIew to display it on the screen. follow these steps: Copy data from disk to kernel buffer Copy data from kernel buffer to user space Generate UIImageView and assign image d

Malloc principle and memory fragmentation

When a process suffers a page disconnection, the process will be in the kernel state and perform the following operations::1. Check whether the virtual address to be accessed is legal2. Find/allocate a physical page3. Fill in the physical page content (read the disk or directly set it to 0, or do nothing)4,Establish a ing relationship (from virtual address to physical address)Re-execute the command with a page disconnectionIf you need to read the disk in step 1, the page Disconnection will be ma

Operating gpio ports at the Linux Application Layer

, "ioreg", FOPS ); Stb_gpio = (stbx25xx_gpio_reg *) ioremap (gpio_base, gpio_len ); If (stb_gpio = NULL ){ Printk (kern_alert "can't get Io base. \ r \ n "); Return-1; } Return 0; } Int io_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned long Arg ){ Unsigned long ugpio; Printk (kern_alert "io_ioctl cmd = % 04x, Arg = % 04x. \ r \ n", CMD, (INT) Arg ); Switch (CMD ){ Case set_io_dir :{ Printk (kern_alert "set_io_dir \ r \ n "); Break; } Case set_io_value :{ Printk (ker

Android App Performance test

One, memory1. View maximum memory limit for a single app appCommand:adb shell "Getprop|grep heapgrowthlimit"128M is the maximum memory limit for a single app, assuming that PSS of the Dalvik Heap is greater than 128. It will report a memory overflow .2. Monitor an app's memoryCOMMAND:ADB Shell Dumpsys Meminfo com.meizu.mstoreC:\USERS\HUJIACHUNGT;ADB Shell Dumpsys meminfo com.meizu.mstoreApplications Memory Usage (KB): uptime:5159608 Realtime : 5159608** meminfo in PID 13914 [Com.meizu.mstore] *

Linux address mappings 1, 2, 3 (☆☆☆)

memory is not enough,Linux will go to the low-end memory area to apply, and vice versa.6} Physical address space outside of Linux administration (otherAddr)Theoretically, the system can manage a physical address space of 4G. x86 architecture more io space. Each device in the computer system is to occupy a certain physical address space, such as PCI device, so will not give 4G to memory, which also means that the system does not support 4G memory.For this part of physical memory outside the phy

POSIX multithreaded Programming Learning notes (vi)-Shared memory (1) __ Programming

provide any synchronization functionality. That is, before the first process finishes writing on shared memory, there is no automatic function to prevent the second process from starting to read it. The problem of access synchronization for shared memory must be the responsibility of the programmer. Optional synchronization methods include mutual exclusion lock, conditional variable, read-write lock, record lock, Semaphore. Second, mmap We'll introd

POSIX shared memory __linux of Linux IPC

: Use the Shm_open () function to open an object that corresponds to the specified name, and the Shm_open () function is similar to the open () system call, which creates a new shared object or opens an existing object. Shm_open () returns a file descriptor that references the object. The file descriptor obtained in the previous step is passed into the mmap () call and specified map_shared in its flags parameter, which maps the shared memory object to

Linux-based V4L2 video architecture driver Authoring __linux

-read the struct v4l2_format struct variable. 4. Control command VIDIOC_REQBUFS//I'm not asking, you ask yourself. Function: Request V4L2 driver to allocate video buffer (Request V4L2 Video Drive Allocate memory), V4L2 is the drive layer of video device, is located in kernel space, so the memory that controls the command word request through VIDIOC_REQBUFS is located in kernel space, the application cannot be accessed directly, After the kernel space memory is mapped to user space by invoking t

File I/O functions in Linux

Tags: full fetch equals mmap file descriptor FD allows different network uploads anonFirst, Lseek functionEach open file has a "current file offset" associated with it. It is usually a non-negative integer used to measure from the beginning of the fileThe number of bytes computed. Typically, read and write operations start at the current file offset and increase the number of bytes read and written by the offset. When you open a text, the offset is se

Management of virtual address space of Linux process

the heap space and mmap area are relatively grown, thus making full use of these address spaces. The top of the mmap area is the stack space, and the stack space is not used, so the stack is generally at the top of the process address space. In general, the highest address of the stack is the highest available address for the user space, and when the specified stack is randomized, a random size is idle, wh

Linux various IPC mechanisms (process communication)

is efficient because the process can read and write directly to the memory without requiring any copy of the data. For communication methods such as pipelines and message queues, four copies of the data are required in the kernel and user space, while shared memory copies only two data [1]: One from the input file to the shared memory area, and the other from the shared memory area to the output file. In fact, when you share memory between processes, you do not always have to read and write sma

V4L2 video collection procedure and Interface Description

Video device and is located in the kernel space, therefore, the memory requested by using the VIDIOC_REQBUFS control command word is in the kernel space and cannot be accessed directly by applications. After you call the mmap memory ing function to map the kernel space memory to the user space, applications access the kernel space by accessing the user space address. Parameter description: The Request Buffer data struct type struct v4l2_requestbuffer

POSIX shared memory and functions in Linux Network Programming

object.Prototype int shm_unlink (const char * Name );ParametersName: name of the shared memory objectReturn Value: 0 is returned for success;-1 is returned for failure. Shm_unlink is similar to shm_ctl (, ipc_rmid ,); Function: maps shared memory objects to the process address space.Prototype void * MMAP (void * ADDR, size_t Len, int Prot, int flags, int FD, off_t offset );ParametersADDR: the starting address to be mapped. It is usually specified as

Comprehensive framebuffer explanation

device maps to the process address space. For example, the following program opens/dev/fb0.Device, and perform address ing through MMAP system calls, and then use memsetClear the screen (Here we assume the display mode is 1024x7688-bit color mode, linear memory mode ): Int FB;Unsigned char * fb_mem;Fb = open ("/dev/fb0", o_rdwr );Fb_mem = MMAP (null, 1024*768, prot_read | prot_write, map_shared, FB, 0 );Me

In-depth analysis of Linux heap memory management (I) and in-depth analysis of Memory Management

describes how to implement ptmalloc2 in linux glibc. Originally, linux uses dlmalloc by default, but since it does not support multi-thread heap management, it was later replaced by prmalloc2 that supports multithreading. Of course, in linux, * malloc is implemented by calling brk or mmap through the system. For this part,Be sure to learn the followingThis article: Https://sploitfun.wordpress.com/2015/02/11/syscalls-used-by-malloc/ In view of the le

Analysis of reading and writing principle of sharedpreference

lock, Judge Mdiskwritesinflight more than 0 o'clock, copy a mmap, Save it to the member Maptowritetodisk of the Memorycommitresult class, and then add the Mdiskwritesinflight to 1. After writing the Maptowritedisk to disk, the mdiskwritesinflight will be reduced by 1, so the Mdiskwritesinflight greater than 0 indicates that Committomemory has been called before, and the map has not been written to disk.Here Mmap

Storage layer in the PHP memory pool

The memory manager of PHP is hierarchical. This manager has three layers: storage, heap, and emalloc/efree. The storage layer uses functions such as malloc () and mmap () to apply for memory from the system, and releases the applied memory through the free () function. The storage layer usually applies for a large amount of memory blocks. Here we apply for "> The memory manager of PHP is hierarchical. This manager has three layers: storage, heap,

Android 4.4 meminfo Implementation Analysis

0 325232 174093 38594 Dalvik Heap 24801 24444 0 0 41476 35899 5577 Dalvik Other 700 700 0 0 Stack 508 508 0 0 Other dev 33564 32600 4 0 .so mmap 9019 1244 7268 0 .apk

Analyzes a Linux kernel bug caused by sendfile

// The following sentence will be harsh, and it will take 0 ~ 1000 of addresses are mapped and executable properties are set.If (personality (0 xffffffff ))! = Per_svr4 ){If (page = MMAP (0x0, 0x1000, prot_read | prot_write, map_fixed | map_anonymous, 0, 0) = map_failed ){Perror ("MMAP ");Return-1;}} Else {If (mprotect (0x0, 0 x1000, prot_read | prot_write | prot_exec) Perror ("mprotect ");Return-1;}}// The

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

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.