virtual-memory

Demand Paging Swapping Frames

戏子无情 提交于 2019-12-12 03:12:49
问题 Disclaimer: This question is related to my operating systems class. However, it's not for any specific homework question. I'm just trying to understand. Here's what I think I know about demand paging so far. Each process has its own paging table. This table contains an index of the logical address, its corresponding physical address, and a valid/invalid bit which indicates whether the page is currently loaded into main memory. When a page is accessed, if the valid/invalid bit is set to valid,

Support for non persisted memorymappedfile

我的未来我决定 提交于 2019-12-12 02:07:59
问题 I want to implement memory mapped file concept as a shared memory to share data between two processes running in my windows system. One in Java and another in native (C# layer). Both are running processes and hence i want to use non persisted mechanism for memory mapped files instead of persisted file option (because a file poses a security threat ). Java File Channels http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#map(java.nio.channels.FileChannel.MapMode, long,

Windows Program Memory Vs Linux Program Memory

只愿长相守 提交于 2019-12-11 11:53:37
问题 Linux creates virtual memory pages for every program to use, and the OS handles mapping the virtual addresses to genuine hardware addresses, correct? But how does Windows do this? Do Windows programs actually have memory that translates to real hardware addresses? I'm also aware that windows can use hard disk memory when RAM is over used, and this process is again called virtual memory, but I believe this is an entirely different concept? 回答1: Windows and Linux (at least on Intel 32/64 bit

Executable Object Files and Virtual Memory

跟風遠走 提交于 2019-12-11 07:58:27
问题 I'm a beginner in Linux and Virtual Memory, still struggling in understanding the relationship between Virtual Memory and Executable Object Files. let's say we have a executable object file a.out stored on hard drive disk, and lets say originally the a.out has a .data section with a global variable with a value of 2018. When the loader run, it allocates a contiguous chunk of virtual pages marks them as invalid (i.e., not cached) and points their page table entries to the appropriate locations

What are the limitations with malloc() on a 64 bit process on macOS?

半城伤御伤魂 提交于 2019-12-11 07:29:06
问题 A fellow programmer claims that his 64 bit Mac program keeps running out of memory due to memory fragmentation. I countered that this is not possible, based on the knowledge that the program only allocates about 1-2 TB of memory in total and most allocations being in the range of 40-200 bytes, even if they're in the millions. I believe it simply is not possible to fragment the 64 bit address space in such a way that an allocation request would fail because the memory allocator cannot find a

Using the pagefile for caching?

帅比萌擦擦* 提交于 2019-12-11 06:18:50
问题 I have to deal with a huge amount of data that usually doesn't fit into main memory. The way I access this data has high locality, so caching parts of it in memory looks like a good option. Is it feasible to just malloc() a huge array, and let the operating system figure out which bits to page out and which bits to keep? 回答1: Assuming the data comes from a file, you're better off memory mapping that file. Otherwise, what you end up doing is allocating your array, and then copying the data

Virtual Memory or Physical Memory

老子叫甜甜 提交于 2019-12-11 03:28:20
问题 Suppose we write a program in C and print the address of one of the variables declared in the program, is the address that gets printed on the screen the virtual address or the physical address of the variable? If it is the virtual address, why is it that it still has the same range as a bit range of physical memory? Eg. for a 32 bit machine if it returns 0x833CA23E. 回答1: The address is going to be a virtual address in virtual memory , because the application has no knowledge of physical

Allocating specific address in Linux

十年热恋 提交于 2019-12-11 02:57:59
问题 I would like to allocate a memory in Linux in process at a specific address. Actually I would like to do something like : I will have number of process. Each process will call an initialization function in a library (written by me) which will allocate some memory in address space of the process (which will store process related information). This will be done by each process Once this memory is allocated, latter the program will call other function in the library. Now these function would

How to unmap struct page from all PTEs mapping it

泪湿孤枕 提交于 2019-12-10 22:49:49
问题 I want to be able to remove a page from page cache so that next access to this page (by any process) will trigger a page fault. I'm doing this from the kernel, and I have a pointer to struct page I wish to remove. Deleting from page cache is easy (done by __delete_from_page_cache() ), but I don't know how to "unmap" this page from all processes mapping it into their VMAs. I tried using try_to_unmap(my_page, cpu_page, TTU_UNMAP|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS) from rmap.c but it doesn't

Simple process loader memory mapping

假装没事ソ 提交于 2019-12-10 22:04:47
问题 I'm writing a very simple process loader for Linux. The executables I'm loading are already compiled, and I know where each one expects to be found in memory. The first approach I tried was using mmap() to manually place each code or data section at the correct location, like mmap(addr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0) which segfaults unless I remove the MAP_FIXED flag because, it seems, the address of one block conflicts with something already in