virtual-memory

Is stack memory contiguous physically in Linux?

梦想与她 提交于 2019-11-28 08:42:12
问题 As far as I can see, stack memory is contiguous in virtual memory address, but stack memory is also contiguous physically? And does this have something to do with the stack size limit? Edit: I used to believe that stack memory doesn't has to be contiguous physically, but why do we think that stack memory is always quicker than heap memory? If it's not physically contiguous, how can stack take more advantage of cache? And there is another thing that always confuse me, cpu executes directives

How do x86 page tables work?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 04:23:56
I'm familiar with the MIPS architecture, which is has a software-managed TLB. So how and where you (the operating system) wants to store the page tables and the page table entries is completely up to you. For example I did a project with a single inverted page table; I saw others using 2-level page tables per process. But what's the story with x86? From what I know the TLB is hardware-managed. Does x86 tell basically tell you, "Hey this is where the page table entries you're currently using need to go [physical address range]"? But wait, I've always thought x86 uses multi-level page tables, so

Understanding Virtual Address, Virtual Memory and Paging

耗尽温柔 提交于 2019-11-28 03:02:29
I've been learning these topics and read many articles and books but they all lack some complementary information and confused me even more. So here, I’d like to explain what I know while I am asking my questions. Hopefully, this topic will be useful for many like me. I'd also like to learn validity of my knowledge and corrections if necessary. Virtual Memory Some articles say “Virtual Memory is some space of Hard Disk which emulates Physical Memory so that we can have more memory than we actually have.”. Some other articles say “Virtual Memory is the combination of Physical Memory (RAM), a

Unexpected page handling (also, VirtualLock = no op?)

╄→гoц情女王★ 提交于 2019-11-27 14:52:09
This morning I stumbled across a surprising number of page faults where I did not expect them. Yes, I probably should not worry, but it still strikes me odd, because in my understanding they should not happen. And, I'd like better if they didn't. The application (under WinXP Pro 32bit) reserves a larger section (1GB) of address space with VirtualAlloc(MEM_RESERVE) and later allocates moderately large blocks (20-50MB) of memory with VirtualAlloc(MEM_COMMIT) . This is done in a worker ahead of time, the intent being to stall the main thread as little as possible. Obviously, you cannot ever

What can my 32-bit app be doing that consumes gigabytes of physical RAM?

感情迁移 提交于 2019-11-27 14:42:07
问题 A co-worker mentioned to me a few months ago that one of our internal Delphi applications seems to be taking up 8 GB of RAM. I told him: That's not possible A 32-bit application only has a 32-bit virtual address space. Even if there was a memory leak, the most memory it could consume is 2 GB. After that allocations would fail (as there would be no empty space in the virtual address space). And in the case of a memory leak, the virtual pages will be swapped out to the pagefile, freeing up

Retrieving the memory map of its own process in OS X 10.5/10.6

倾然丶 夕夏残阳落幕 提交于 2019-11-27 13:21:04
In Linux, the easiest way to look at a process' memory map is looking at /proc/PID/maps , giving something like this: 08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm 08056000-08058000 rw-p 0000d000 03:0c 64593 /usr/sbin/gpm 08058000-0805b000 rwxp 00000000 00:00 0 40000000-40013000 r-xp 00000000 03:0c 4165 /lib/ld-2.2.4.so 40013000-40015000 rw-p 00012000 03:0c 4165 /lib/ld-2.2.4.so 4001f000-40135000 r-xp 00000000 03:0c 45494 /lib/libc-2.2.4.so 40135000-4013e000 rw-p 00115000 03:0c 45494 /lib/libc-2.2.4.so 4013e000-40142000 rw-p 00000000 00:00 0 bffff000-c0000000 rwxp 00000000 00:00 0

Windows - Commit Size vs Virtual Size

我只是一个虾纸丫 提交于 2019-11-27 11:34:24
i would like to know the exact difference between Commit Size (visible in the Task Manager ) and Virtual Size (visible in SysInternals' Process Explorer ). The Virtual Size parameter in Process Explorer looks like a more accurate indicator of Total Virtual Memory usage by a process. However the Commit Size is always smaller than the Virtual Size and I guess it does not include all virtual memory in use by the process. I would like somebody to explain what is exactly included in these parameters. Memory can be reserved, committed, first accessed, and be part of the working set. When memory is

Difference between physical/logical/virtual memory address

时间秒杀一切 提交于 2019-11-27 10:42:00
I am a little confused about the terms physical/logical/virtual addresses in an Operating System(I use Linux- open SUSE) Here is what I understand: Physical Address- When the processor is in system mode, the address used by the processor is physical address. Logical Address- When the processor is in user mode, the address used is the logical address. these are anyways mapped to some physical address by adding a base register with the offset value.It in a way provides a sort of memory protection. I have come across discussion that virtual and logical addresses/address space are the same. Is it

Difference between sequential write and random write

和自甴很熟 提交于 2019-11-27 09:36:12
问题 What is the difference between sequential write and random write in case of :- 1)Disk based systems 2)SSD [Flash Device ] based systems When the application writes something and the information/data needs to be modified on the disk then how do we know whether it is a sequential write or a random write.As till this point a write cannot be distinguished as "sequential" or "random".The write is just buffered and then applied to the disk when we will flush the buffer. Please correct me if I am

Why does the stack address grow towards decreasing memory addresses?

好久不见. 提交于 2019-11-27 06:49:13
I read in text books that the stack grows by decreasing memory address; that is, from higher address to lower address. It may be a bad question, but I didn't get the concept right. Can you explain? First, it's platform dependent. In some architectures, stack is allocated from the bottom of the address space and grows upwards. Assuming an architecture like x86 that stack grown downwards from the top of address space, the idea is pretty simple: =============== Highest Address (e.g. 0xFFFF) | | | STACK | | | |-------------| <- Stack Pointer (e.g. 0xEEEE) | | . ... . | | |-------------| <- Heap