Memory Mapping in OS

Q.1: What is Memory mapping in OS?

Answer:

Memory mapping or mmap() is a function call thats helps to directly map a file to the currently executing process’s own memory address space.

Q.2: What are the types of memory mapping?

Answer:

1. File Mapping: It will map the File to the process virtual memory.

-Read only Mappings

-Read-Write Mappings

2. Anonymous mapping: It is a memory mapped region where there is no connection with any file/device. Or we can say it is used for dynamic allocation of memory within a program.

Q.3: What are the functions used for memory mapping and un-mapping?

Answer:

mmap() and munmap()



Memory Mapping

Modern computers have a virtual memory that is not physically present. We can achieve it by setting up a Hard disk, this way extended memory is called virtual memory. So any program that is inside the computer will have a virtual memory address to store data. This data cannot be used unless it is converted to a physical address. So, In short, Memory Mapping is the process done by the Operating System to translate Virtual memory addresses to physical addresses. So, the program can run anytime when the OS loads it as it is required.

Similar Reads

What is Memory Mapping?

Memory mapping or mmap() is a function call in an Operating system like Unix. It is a low-level language, and it helps to directly map a file to the currently executing process’s own memory address space. Which could optimize File I/O operations, inter-process communication, etc....

Implementation of Memory-Mapping Algorithm

Memory mapping involves a series of steps. An algorithmic explanation of how memory mapping can be implemented in C is provided here:...

FAQs on Memory Mapping in OS

...

Contact Us