FAQ Database Discussion Community


Linux - process killed when linking section into lowest 2 MB of memory?

linux,linker,ld,virtual-memory,linker-scripts
I'm learning about LD linker scripts, and I noticed that if I link the .text section (or any section) at an address lower than than 2 MB, my process gets instantly killed by Linux as soon as I run it. Here's an example script I'm using: SECTIONS { . =...

When will the virtual page number have more bits than the physical frame number?

virtual-memory
I have the following question on a practice exam: For a computer system that implements paging, under what circumstance will the VPN (virtual page number) have more bits than the PFN (physical frame number)? I am trying to argue that: The number of bits to represent the virtual page number...

What causes a “Virtual Memory exhausted” error?

objective-c,xcode,allocation,virtual-memory,exhaustive
Alright.. Here's the thing.. I am building an app in which when the user taps on download button it downloads a bunch on images (296, to be exact). In simulator everything works flawless, on my iPhone (4S) on around 100th image it crashes with error: malloc: * mach_vm_map(size= "some random...

Driver mmap operation Page table creation

linux-kernel,linux-device-driver,mmap,virtual-memory,page-tables
I am trying to understand mmap operation in a driver. I know why we are doing mmap. I am confused with the following 2 implementations of mmap: int my_mmap(struct file *filp, struct vm_area_struct *vma) { vma->vm_ops = &mmap_vm_ops; vma->vm_flags |= VM_RESERVED; /* assign the file private data to the vm...

C++ porting VirtualFree in OS X

c++,osx,memory,memory-management,virtual-memory
I'm trying to make a port of our memory management in which some allocators use virtual memory mechanism to reserve address space without (at the beginning) allocate any physical memory and later allocate memory only when they need. The code is based on Windows' VirtualAlloc and VirtualFree to make the...

Prevent the OS from swapping objects to virtual memory/disk in Java?

java,virtual-memory
So I have a program that has the user enter a passphrase. I only hold the passphrase for a few seconds in a char[] before overwriting it but I was wondering if there was a way in Java to prevent the OS from swapping this bit to disk/virtual memory/any more...

How does virtual memory maintains its efficiency?

c,system,virtual-memory
Given the large number of miss penalties, why doesn't paging affects or reduces the program performance? how is possible for virtual memory to be efficient?

Multiple mappings for a physical page

c,linux,mmap,virtual-memory
I want to create a copy-on-write like interface for accessing a mmap()ed file in GNU C. Here is the way it should work: I will map the file to the address space using mmap(). Doing so, I will have a pointer to a contiguous region of memory which will contain...

When to do or not do INVLPG, MOV to CR3 to minimize TLB flushing

x86,paging,x86-64,virtual-memory,tlb
Prologue I am a operating system hobbyist, and my kernel runs on 80486+, and supports virtual memory already. Starting from 80386, the x86 processor family by Intel and various clones thereof has supported virtual memory with paging. It is well known that when the PG bit in CR0 is set,...

Why not use a ‘block table’ for file systems (in analogy to a page table)?

memory-management,operating-system,filesystems,virtual-memory
File system structure seems similar to memory management structure: Mapping non-contiguous physical frames to contiguous virtual memory Mapping non-contiguous physical disk blocks to contiguous file. Why not use a ‘block table’ for file systems (in analogy to a page table)?...

Calculate Virtual Memory Page Faults Number

caching,memory,mips,virtual-memory
I have trouble with calculating number of page faults. I have a question that is: Consider the two-dimensional array D defined as follows: int D (128, 128); # each element is one word (I think it means 32 bit) Assume that the OS only makes one 1024-byte page frame available...

Mapping virtual address to physical address

c++,memory-management,memory-address,virtual-memory,windows-embedded-compact
I have a project which I need to get working in C++ in VS2010 under Windows 7. The project was originally developed to run on WinCE . It was developed in VC++ but linked to some libraries used in the WinCE dev environment. The project uses ::VirtualCopy which fails to...

Will OS provide virtual address space?

operating-system,virtual-memory
This is an interview question. I am writing all the details the interviewer gave me. The question is:- A system has a memory of 1GB. A process requires only 1MB of memory. Assuming no other processes are running in memory, will the OS provide virtual address translation for this process...

Memory Management (Allocating Pages/Frames to Logical Addresses)

memory,memory-management,operating-system,paging,virtual-memory
I am new to Operating Systems and I was following this handbook which I am reading to get a better grasp on how computers really work. However having stumbled upon Memory Management I found it somewhat confusing when allocating Frames to Pages using Page tables. Say Page/Frame size is 4K...

High memory mappings in kernel virtual address space

linux,memory-management,linux-kernel,virtual-memory
The linear address beyond 896MB correspond to High memory region ZONE_HIGHMEM. So the page allocator functions will not work on this region, since they give the linear address of directly mapped page frames in ZONE_NORMAL and ZONE_DMA. I am confused about these lines specified in Undertanding linux Kernel: What do...

Flush TLB on a context swtich

operating-system,virtual-memory,context-switch,tlb,page-tables
This may depends on the OS, but in general as I understand that when there a page fault (the desired page is not in main memory) occurs OS will instruct CPU to read the page from disk, and I am wondering does OS dispatch to another process while the disk...