virtual-memory

How does the OS update the appropriate page table when it evicts a victim page?

本秂侑毒 提交于 2019-12-13 21:26:20
问题 In an OS that uses virtual memory, each process has a page table. Each page table maps a process's virtual memory pages to the system's physical memory pages and indicates whether a given page is currently valid (loaded in memory) or not. Suppose that memory is running low and the OS needs to choose a page to evict from physical memory. There are different algorithms for this. For example, FIFO, LRU. Once the OS chooses a page to evict, how does it invalidate any existing references to the

on Linux, printing function addresses always prints 1 (c++)

空扰寡人 提交于 2019-12-13 18:36:13
问题 I'm developing a c++ program that is dealing with addresses for different variables and functions. When I compiled my program on a Linux based OS, all functions including the main get the address of 1 instead of an 8 digit hexa number like other variables, which did not happen in Windows. I wrote this small piece of code to explain the issue #include <iostream> using namespace std; void Function1(); void Function1() { } int main() { int tmp; void (*a) ()=&Function1; cout<<a<<endl; cout<<

Retrieving the memory map of its own process in QNX

青春壹個敷衍的年華 提交于 2019-12-13 05:21:59
问题 In Linux if we look at the /proc/self/maps: 00400000-004ef000 r-xp 00000000 08:01 12845058 /bin/bash 006ef000-006f0000 r--p 000ef000 08:01 12845058 /bin/bash 006f0000-006f9000 rw-p 000f0000 08:01 12845058 /bin/bash 006f9000-006ff000 rw-p 00000000 00:00 0 00d5a000-010a2000 rw-p 00000000 00:00 0 [heap] 7f6fe582a000-7f6fe5835000 r-xp 00000000 08:01 1048595 /lib/x86_64-linux-gnu/libnss_files-2.19.so 7f6fe5835000-7f6fe5a34000 ---p 0000b000 08:01 1048595 /lib/x86_64-linux-gnu/libnss_files-2.19.so

XP: Large Virtual Memory & normal Mem Usage in Task Manager

匆匆过客 提交于 2019-12-13 02:37:16
问题 What does large VM page size and normal Memory usage numbers from Task Manager mean for an application? Do they mean the application is poorly performing in terms of memory usage? We have an application which some users claim that make their XP machines slow. We see that the user have other heavy applications running as well. But when we see their task Manager figures we realize "Memory Usage" column in task Mgr is normal for our app but the VM size is pretty high compared to others

How to unmap an mmap'd file by replacing with a mapping to empty pages

£可爱£侵袭症+ 提交于 2019-12-13 00:31:43
问题 Is there a way from Linux userspace to replace the pages of a mapped file (or mmap'd pages within a certain logical address range) with empty pages (mapped from /dev/null , or maybe a single empty page, mapped repeatedly over the top of the pages mapped from the file)? For context, I want to find a fix for this JDK bug: https://bugs.openjdk.java.net/browse/JDK-4724038 To summarize the bug: it is not currently possible to unmap files in Java until the JVM can garbage collect the

Can the page table be paged out?

喜你入骨 提交于 2019-12-13 00:17:00
问题 According to my understanding it shouldn't be, since it's in kernel space and kernel space is non pageable. But with 64 bit address space I don't see how it can hold the full page table since it would be prohibitively large. Any ideas on how this achieved? Also I guess even holding it on disk fully would take a lot of space. Since most of the VM space would be unused is there way to limit the page table to contain only used VM address ranges? 回答1: The page table is actually a tree: it

Spark Worker asking for absurd amounts of virtual memory

两盒软妹~` 提交于 2019-12-12 16:15:41
问题 I am running a spark job on a 2 node yarn cluster. My dataset is not large (< 100MB) just for testing and the worker is getting killed because it is asking for too much virtual memory. The amounts here are absurd. 2GB out of 11GB physical memory used, 300GB virtual memory used. 16/02/12 05:49:43 WARN scheduler.TaskSetManager: Lost task 0.0 in stage 2.1 (TID 22, ip-172-31-6-141.ec2.internal): ExecutorLostFailure (executor 2 exited caused by one of the running tasks) Reason: Container marked as

How to change the Linux kernel swap daemon (kswapd) timeout?

会有一股神秘感。 提交于 2019-12-12 14:34:21
问题 I want to reduce the kswapd timeout to increase the performance by use of fast devices like Flash, SSD as swapping devices. 回答1: You can change the behavior of kswapd through 2 ways Through Proc File System From IBM Developerworks, /proc/sys/vm/kswapd Maximum number of pages the kernel tries to free at one time. If you want to increase bandwidth to/from swap, you will need to increase this number. Minimum number of times the kernel tries to free a page on each swap. The number of pages the

Is VirtualAlloc alignment consistent with size of allocation?

非 Y 不嫁゛ 提交于 2019-12-12 12:17:08
问题 When using the VirtualAlloc API to allocate and commit a region of virtual memory with a power of two size of the page boundary such as: void* address = VirtualAlloc(0, 0x10000, MEM_COMMIT, PAGE_READWRITE); // Get 64KB The address seems to always be in 64KB alignment, not just the page boundary, which in my case is 4KB. The question is: Is this alignment reliable and prescribed, or is it just coincidence? The docs state that it is guaranteed to be on a page boundary, but does not address the

legacy gcc compiler issues

倖福魔咒の 提交于 2019-12-12 10:39:21
问题 We are using a legacy compiler, based on gcc 2.6.0, to cross compile for an old imbedded processor we are still using (yes, it is still in use since 1994!). The engineer that did the gcc port for this chip has long since moved on. Although we might be able to recover the gcc 2.6.0 source from somewhere on the web, the change set for this chip has disappeared in the halls of corporate history. We have muddled along until recently as the compiler still ran and produced workable executables, but