Presentation is loading. Please wait.

Presentation is loading. Please wait.

Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.

Similar presentations


Presentation on theme: "Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a."— Presentation transcript:

1 Virtual Memory By: Dinouje Fahih

2 Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a very large range of memory or storage addresses for stored data. The computing system maps the programmer's virtual addresses to real hardware storage addresses (Hard Disks). In addition to managing the mapping of virtual storage addresses to real storage addresses, a computer implementing virtual memory or storage also manages storage swapping between active storage (RAM) and hard disk or other high volume storage devices

3 All modern general-purpose computer operating systems use virtual memory techniques for ordinary applications, such as word processors, spreadsheets, multimedia players, accounting, etc All modern general-purpose computer operating systems use virtual memory techniques for ordinary applications, such as word processors, spreadsheets, multimedia players, accounting, etc Older operating systems, such as DOS of the 1980s, or many mainframe operating systems of the 1960s, had no virtual memory functionality. Older operating systems, such as DOS of the 1980s, or many mainframe operating systems of the 1960s, had no virtual memory functionality. Embedded Systems and other special-purpose computer systems which require very fast, very consistent response time do not generally use virtual memory. Embedded Systems and other special-purpose computer systems which require very fast, very consistent response time do not generally use virtual memory.

4 Computer Memory Hierarchy

5 Virtual Memory Usage. Memory Extension Memory Extension Memory Protection Memory Protection

6 How Does it Work?  Memory Management Unit (MMU) Hardware component responsible for handling accesses to memory requested by the (CPU). One of Its functions include translation of virtual addresses to physical addresses (Virtual Memory management),

7 ► Virtual Memory provides expansion of Main Memory by ‘overflowing’ data and program code onto Magnetic Disk. ► The area on disk reserved for this purpose is known as the Swap Space ► Dividing main memory into Frames (pages)

8 Pages Pages The RAM physical memory subdivided into 4kb-64kb pages. 512MB/4K = 131072 pg Page Table Page Table provides a look up whereby the logical page number can be exchanged for the physical frame number. It is an Array of (PTE). It is an Array of (PTE).

9 Process Process When programs are using the CPU at the same time, each running program and the data structures needed to manage it. When programs are using the CPU at the same time, each running program and the data structures needed to manage it. Addresses Addresses A Load Instruction A Load Instruction A Store Instruction A Store Instruction Fetching an Instruction Fetching an Instruction

10

11 Maximum Virtual Address space: Size of a program address is determined by the maximum size of the virtual address space. The number of bits in a virtual address is the log base 2 of this value. Size of a program address is determined by the maximum size of the virtual address space. The number of bits in a virtual address is the log base 2 of this value. Maximum Physical Address space: The amount of real memory that the system can support determined the number of bits needed to address the physical memory. The size of physical address is log base 2 of this value. Size of a Page: This is the size of a virtual memory page and a physical memory frame. It is always a power of 2 Virtual Memory Address Translation

12 Page number and page offset A virtual address is therefore split into two parts. The more significant part gives the page number. The less significant part gives the address of the byte within the page. The less significant part is also called the “page offset.” A virtual address is therefore split into two parts. The more significant part gives the page number. The less significant part gives the address of the byte within the page. The less significant part is also called the “page offset.” The number of bits allocated to the page offset should be able to address every byte in the page. Therefore, in our example. Since we have 4 KB = 2 12 byte page tables, we need 12 bits for page offset. The number of bits allocated to the page offset should be able to address every byte in the page. Therefore, in our example. Since we have 4 KB = 2 12 byte page tables, we need 12 bits for page offset. Likewise for the physical address. Likewise for the physical address.

13 13 bits 10 bits page number offset 16MB Maximum Virtual Address space (24 bits) 8MB Maximum Physical Address space (23 bits) 1024byte Page size (10 bits) Virtual Address can be represented as: 16MB Maximum Virtual Address space (24 bits) 8MB Maximum Physical Address space (23 bits) 1024byte Page size (10 bits) Virtual Address can be represented as:

14 Page Fault The memory manager locates the missing page in secondary memory. The memory manager locates the missing page in secondary memory. The page is loaded into primary memory, usually causing another page to be unloaded. The page is loaded into primary memory, usually causing another page to be unloaded. The page table in the memory manager is adjusted to reflect the new state of the memory. The page table in the memory manager is adjusted to reflect the new state of the memory. The processor re-executes the instructions which caused the page fault. The processor re-executes the instructions which caused the page fault.

15 Translation Look-aside Buffer The TLB tends to be fully associative. The TLB uses write-back. Therefore, needs a dirty bit to indicate if the page is dirty Or have a Read or Write Permission bit This is because a TLB miss is very costly, and is to be avoided.

16

17 MEMORY PERFORMANCE COMPARISON

18 How to Access the Virtual Memory in your Computer? 1

19 2 3

20 4RAM Virtual Mem. 1GB 1536MB 2048MB 2GB3072MB4096MB 3GB4644MB6144MB

21 Conclusion! Questions??


Download ppt "Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a."

Similar presentations


Ads by Google