Questions tagged [virtual-memory]

Questions about techniques for providing the appearance of an isolated, contiguous address space to each process. The size of the address spaces may be made to appear larger than the size of main memory by moving pages or segments between main memory and a larger backing store.

Filter by
Sorted by
Tagged with
15
votes
1answer
18k views

How does a TLB and data cache work?

I'm trying to study for an exam and I realized I'm confused about how the TLB and data cache work. I understand that the TLB is essentially a cache of most recently used physical addresses. However, ...
14
votes
1answer
4k views

If the virtual address space can be larger than the physical address space, how are the address mappings stored in memory?

Let's say we are working with a system that has 40 physical address bits. The total physical address space (assuming byte-addressable memory) is $2^{40}$ bytes, or 1 TiB. And if virtual addresses are ...
13
votes
1answer
523 views

Memory ballooning in the OS

Some hypervisors optimize memory usage using a method that is called ballooning (at least that's what KVM calls it), this method deduplicates memory between VMs and sets common pages to read-only with ...
11
votes
1answer
5k views

Swap space management during pure demand paging

The following is a doubt that I came across while doing a OS home assignment - however, it seems more concept-based than a straightforward coding question, so IMHO I don't think the homework tag is ...
9
votes
2answers
34k views

Clock page replacement algorithm - Already existing pages

When simulating the clock page replacement algorithm, when a reference comes in which is already in memory, does the clock hand still increment? Here is an example: With 4 slots, using the clock ...
7
votes
1answer
119 views

Page management in OS kernels

I looked at some old OS theory books of mine and noticed that one glaring omission in all of these OS books is how to actually keep track of physical pages that are free (i.e. algorithms for actually ...
6
votes
2answers
29k views

How does increasing the page size affect the number of page faults?

If we let the physical memory size remain constant, What effect does the size of the page have on the number of frames? What effect does the number of frames have on the number of page faults? Also,...
6
votes
1answer
2k views

How to interpret “Windows - Virtual Memory minimum too low” from a CS student point of view?

On my old 256MB RAM, pc I get this message. (I guess it is quite common) Windows - Virtual Memory minimum too low Your system is low on virtual memory. Windows is increasing the size of your ...
5
votes
3answers
6k views

Look Ahead buffer vs Translation Look aside buffer

I know that Translation look aside buffer is used for address translation in paging to achieve better performance. I came across term called Look Ahead buffer in a document which said it implements ...
5
votes
1answer
5k views

Program compilation and execution flow

I was studying operating system concepts from Silberschatz, Galvin and Gagne's book (sixth edition) and I have some questions about the flow of execution of a program. A figure explains the processing ...
5
votes
0answers
328 views

When there's no memory, should malloc or read/write fail?

To my surprise, I recently found out that Windows would fail a large memory allocation even if little of said memory is to actually be used, e.g. even if you don't want the swap, you better not ...
4
votes
2answers
447 views

Understanding non-faulting and faulting software prefetches

What is the difference between a faulting and non-faulting software prefetch. I have read some material in Google but can't understand it deeply. How do we know if a software prefetch is faulting or ...
4
votes
1answer
1k views

How are system calls handled in a virtual machine?

Quoting wikipedia, a system call is: In computing, a system call is how a program requests a service from an operating system's kernel. This may include hardware related services (e.g. ...
4
votes
2answers
795 views

Why does quicksort work well with virtual memory?

Introduction to Algorithms said that quicksort "works well even in virtual-memory environments," but didn't explain why. I've tried looking an Wikipedia and Stack Exchange, but found no reason why. Is ...
4
votes
1answer
3k views

Page Table Size in a 4 Level Hierarchical Page Table

An Intel 64 bit CPU uses a four-level hierarchical page table. Each of the four levels of the page table can contain 512 entries, and the page table size is 4KB. You should be able to see that it ...
3
votes
1answer
670 views

Representing non-contiguous memory regions as a standard vector with O(1) access

What interesting alternatives are there for constructing an arbitrarily large static array from smaller scattered blocks of fixed-sized non-contiguous blocks of memory? This is similar to the ...
3
votes
3answers
3k views

Virtual Address and Physical Address Space

A machine has 48-bit virtual addresses and 32-bit physical addresses. Pages are 8K. How many entries are needed for a conventional page table ? The answer is 2^35 entries Why not (2^32) / (2^13) = ...
3
votes
2answers
2k views

How to calculate the size of a page in a two level paging CPU?

I am having difficulties with understanding the concept of paging. As a result I've got no idea how I can solve the following exercise - I'm lacking one more equation to solve it. I've read a lot ...
3
votes
3answers
65 views

Machine code: How can an OS prevent user-level programs from accessing each other's memory? [duplicate]

Okay, I’ve done a lot of research on this, but I can’t seem to wrap my head around it. Essentially, the question is as follows: How can an operating system prevent a machine instruction from a user-...
3
votes
1answer
3k views

What problem does cache coloring solve?

According to what I have read from two different sources, cache coloring is (was?) required in order to: Counter the problem of aliasing: Prevent two different virtual addresses with the same ...
3
votes
1answer
2k views

Understanding the basic concepts in memory organisation

(Before actually proceeding to the question, I want to confess that this is a homework question, please do consider it and help me in improving my understanding a bit more.) I have recently started ...
3
votes
0answers
270 views

Paging: Does the page table of a process also gets swapped out when the process gets swapped out from main memory?

Does a process's page table too gets swapped out to secondary storage from main memory when the process gets swapped out to secondary storage from main memory? And gets swapped back in when the ...
3
votes
0answers
112 views

Isn't resident set management superfluous?

My question is in the context of a paging virtual memory system. THE PREMISES: The function of resident set management (RSM) is to: Impose an upper bound on the cardinality of a process' resident ...
2
votes
1answer
626 views

Where are 'Base & Bounds' registers located?

I read about virtual memory from L08/CS152 of U.C Berkeley and used to deep dive into the details of VM hardware implementation, yet didn't find any document or figure on the course specifying where ...
2
votes
2answers
3k views

Difference between virtual memory and job pool

Both virtual memory and job pools store the processes temporarily on disk and bring them to memory at some later stage, so what is the actual difference in between them? What I guess is that when a ...
2
votes
1answer
38 views

Transform calculation to memory

Theoretically, is it possible to convert the processing power of the CPU into several tens of bits of memory? My question is unusual, but it's very interesting. I'm looking for a way to create a ...
2
votes
4answers
9k views

Calculation of effective average instruction execution time in a 2-level paging system

System has a two level paging scheme Average CPU time for a instruction = 100ns Average number of memory accesses per instruction = 2 Regular memory access = 150 ns Page fault service time = ...
2
votes
1answer
90 views

What does it mean " The outer level page table need not be page aligned?

The question is in context to multilevel page table. I was trying to solve numerical on multi-level paging and noticed that page size might not be same at all levels. I came across the point "Outer ...
2
votes
1answer
53 views

Why not space out memory allocations?

In ext4 file system, the files are spaced out as far apart as reasonably possible to allow for efficient reallocation. Why do we not do this in memory? Why not allocate one memory as page 20, and the ...
2
votes
0answers
633 views

How are LRU and Clock algorithm different?

I am modeling the Gclock-pro buffer replacement algorithm in Linux kernel. Because there are many existing modeling works on LRU, I am considering adopting LRU model to roughly describe Gclock-pro, ...
2
votes
1answer
1k views

Maximum amount of memory that can be allocated to a process

DISCLAIMER: The following scenario was taken from an assignment I got in a OS course I'm taking, and it arose a lot of question marks in my head. However non of the questions asked by myself here ...
1
vote
1answer
6k views

Would it be possible to use the cloud for RAM?

I'm not sure if this is the right place to ask but I had this idea. Since the cloud can be used for storing memory, would it be possible to use it for RAM too?
1
vote
1answer
1k views

How a program is copied to RAM from harddisk

I know that for executing a program, it should be copied to RAM. But the problem is whole of it may not be copied always. Since the size of the RAM is limited, there is mechanism called virtual ...
1
vote
1answer
127 views

How earliest that the data TLB (Translation Lookaside Buffer) can be accessed in an instruction execution pipeline?

In an instruction execution pipeline, the earliest that the data TLB (Translation Lookaside Buffer) can be accessed is: List item before effective address calculation has started during effective ...
1
vote
2answers
61 views

What is the difference between a page and thread?

"Each process that is executed is divided into blocks of same size, called pages." "Thread is a part of process being executed." Are pages and threads both part(s) of process? Whats the difference ...
1
vote
2answers
765 views

How many times do we access memory with a TLB?

As I understand it, when we are on a virtual memory based system, we have to access memory 2 times (one for the Page Table and one for the physical address in RAM). But, how many times would we have ...
1
vote
1answer
381 views

Effect of Copy-On-Write on 2 processes sharing address space

I am studying operating systems and was going through Copy On Write mechanism. From Wiki: When one process modifies the memory, the operating system's kernel intercepts the operation and copies ...
1
vote
1answer
2k views

What are logical addresses and where do they actually reside?

While studying about memory management, paging and segmentation there is a lot of usage of phrases like CPU generates logical addresses and ...
1
vote
1answer
44 views

Slowdown when accessing data at page boundaries?

Hi I have a program which accesses memory words that are located X bytes apart in virtual address space. For instance, ...
1
vote
2answers
42 views

If you increase the address space for an OS, does the Phys Mem used by the program increase?

I am learning about the OS. I know: that Address Space Size = # of pages x page size So if I increase Address Space Size, then the number of pages increases:(not the page size). However, isn't the ...
1
vote
1answer
1k views

How does malloc(sizeof(char)) work [closed]

AFAIK, malloc(sizeof(char)) is intended to allocate a 1-byte block of VM and strcpy requires that the destination string dest must be large enough to receive the copy That means theorically that ...
1
vote
1answer
12k views

How to calculate virtual address space from page size, virtual address size and page table entry size?

I try to solve an exercise, unfortunately without any success yet. From the following given information, the virtual address space should be calculated: Page size is 16 KB Logical address size is 47 ...
1
vote
1answer
1k views

Number of addresses in a memory region

So I am looking at some Operating Systems exercises and we have A swapping system eliminates holes by compaction. Assuming a random distribution of many holes and many data segments ...
1
vote
2answers
1k views

Why is data fragmentation not possible on main memory (RAM)?

I am wondering why data fragmentation is a problem on main memory. On a software level, virtual addresses are used anyway. So why can one address space not be split up into multiple segments, like a ...
1
vote
1answer
199 views

Role of the MMU in a Page Fault Swap

When a virtual memory address outside the range of loaded into physical RAM is referenced and a page fault occurs, does the Memory Management Unit rely on DMA (Direct Memory Access) to swap the ...
1
vote
1answer
343 views

How pictures and videos are usually loaded in Memory? [closed]

Lets assume I'm talking about Jpeg and Mp4 and a general video player(not sure if different ones load it differently, if they do please tell) So do video players (process) usually load the entire ...
1
vote
2answers
230 views

Does the Working Set Paging Algorithm use a separate page table?

I am doing research on paging algorithms. While learning about the working set algorithm from several scientific sources I was not really able to figure out where exactly the working set is defined or ...
1
vote
1answer
59 views

How does the OS detect B&B violation from hardware?

After reading about Base & Bounds memory protection mechanism from Stanford CS140 lecture notes, I understood from the explanation below that there is an ...
1
vote
1answer
4k views

What does 'relocation' mean?

I am reading about Base & Bounds memory protection mechanism, and I noticed the use of the term 'relocation' in the context of ...
1
vote
2answers
118 views

I need help with virtual memory problem

• Given the above virtual to physical address mapping, 1 What is the page size? 2 How many virtual pages can we have in maximum? 3 How many physical pages can we have in maximum? Approach: 1 For ...