virtual-memory

Memory region flags in Linux: why both VM_WRITE and VM_MAYWRITE are needed?

点点圈 提交于 2020-02-25 06:22:05
问题 "Understanding the Linux Virtual Memory Manager" (2007) by Mel Gorman (here's a link to the book chapter) describes the flags of a memory region (vm_area_struct): VM_WRITE - Pages may be written VM_MAYWRITE - Allow the VM_WRITE flag to be set I don't understand why Linux needs these two flags, rather than just one of them. From the description above, it sounds like VM_MAYWRITE be set while VM_WRITE is not. In what situations? And how does the Linux kernel behave differently in these

Why is the heap section present when there are no malloc used

无人久伴 提交于 2020-02-07 07:23:07
问题 I am trying to find out whether heap exists in the address space of the process, if we don't call malloc. #include <stdio.h> int main() { getchar(); return 0; } Heap section is present in the maps even if i dont call malloc cat /proc/73268/maps 55d0b405c000-55d0b4160000 r-xp 00000000 08:01 5505031 /bin/bash 55d0b435f000-55d0b4363000 r--p 00103000 08:01 5505031 /bin/bash 55d0b4363000-55d0b436c000 rw-p 00107000 08:01 5505031 /bin/bash 55d0b436c000-55d0b4376000 rw-p 00000000 00:00 0 55d0b567e000

How virtualized page table works

余生长醉 提交于 2020-01-24 15:29:06
问题 Reading about the virtualized page table concept, where part of the page table is put in virtual memory. Wikipedia as well as Patterson & Hennessy (5.7 elaboration in the Page Faults section) say that the reason you don't put the entire page table into virtual memory is that it can lead to circular page faults. But it seems to me like there's an even more basic issue - how you would find the page table in the first place? It seems like you necessarily need some record of where in physical

Does page walk take advantage of shared tables?

半世苍凉 提交于 2020-01-15 07:53:22
问题 Suppose two address spaces share a largish lump of non-contiguous memory. The system might want to share physical page table(s) between them. These tables wouldn't use Global bits (even if supported), and would tie them to asid s if supported. There are immediate benefits since the data cache will be less polluted than by a copy, less pinned ram, etc. Does the page walk take explicit advantage of this in any known architecture? If so, does that imply the mmu is explicitly caching & sharing

Linux (Ubuntu), C language: Virtual to Physical Address Translation

二次信任 提交于 2020-01-10 02:53:09
问题 As the title suggests, I have a problem of obtaining the physical address from a virtual one. Let me explain: Given a variable declaration in process space, how can I derive it's physical address mapped by the OS? I've stumbled upon some sys calls /asm/io.h where the virt_to_phys() function is defined; however it seems this header is outdated and I can't find a work around. However; io.h is available at: /usr/src/linux-headers-2.6.35-28-generic/arch/x86/include/asm/ . My current kernel is 2.6

Sample of virtual memory using to work with Big Arrays

爱⌒轻易说出口 提交于 2020-01-06 14:17:27
问题 I am dumb in C++/C# and WinAPI. Can someone share with me useful links or show simple sample of using virtual memory for working with big arrays( on C++ or on C#). Thanks in advance. 回答1: I think what you are after is using Memory Mapped Files which allows you to use the content of a file "as if" it was loaded into memory when in actuality it exists mostly on disk. Take a look at "Creating a File View" on MSDN for windows, or man mmap for Linux. 回答2: Virtual memory is not a property of your

iOS Application Crash while UIImage loading (virtual memory not cleaning up)

旧城冷巷雨未停 提交于 2020-01-05 05:56:26
问题 I have a weird crash in my application without any trace. this is probably a memory related problem but with very little information & I'm not sure how to proceed or fix it. If it wasnt for instruments would have been left with no clue what so ever. I have an image array (in this example an array of size 2) where I load an image, create an image context & draw and save it into the array. Everytime the method is called image array objects are replaced with the new content. In instruments I see

How can a process try to access other process's memory in Linux virtual memory system

拜拜、爱过 提交于 2020-01-04 04:03:26
问题 Just got confused when I am learning the virtual memory system in Linux. Since each process has its own virtual address space and its own page table translating its virtual address to physical address(am I right?), how can it possibly try to falsely access other process's memory? There should be no entry in the page table, right? 回答1: Unless specifically arranged, there should be no virtual address one process can access that will modify memory assigned to another process. 回答2: A linux

Memory Swapping and Virtual Memory on iOS [closed]

断了今生、忘了曾经 提交于 2020-01-03 09:46:31
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Does iOS support memory swapping and virtual memory that automatically runs like Linux? 回答1: iOS has virtual memory, but no backing store, so there is no paging in/out from swap memory. Apple's About the Virtual Memory System documentation should give you a general idea about how

calculating page size and segment size

时光怂恿深爱的人放手 提交于 2020-01-02 12:27:29
问题 in a paged-segmented system we have the virtual address of 32 bits and 12 bits for the offset,11 bits for segment and 9 bits for page number.the how can we calculate the page size ,maximum segment size and maximum number of segment size? 回答1: 12 bits are reserved for offset, so the page size is 2^12 = 4KB 9 bits are reserved for page number, so each segment can contain 2^9 = 512 pages Each segment can grow up to size of (# of pages) * (pages size), so maximum segment size is 512 * 4K = 2M For