Computer Architecture (16)

김동규·2023년 12월 10일
0

Computer Architecture

목록 보기
16/16

This is the last post in the memory section. In this post, I will talk about the Virtual Memory.

This is the memory hierarchy. The position between memory and disk will be used to virtual memory.

For that reason, we need to Virtual Memory. If some memory shared between multiple processes, we have to protect the original value. It means one processor can modify some data. It will be affected other processes. To avoid this problem, we need to think about that every program has the virtual memory.


Virtual Memory

It has 2 storage levels primary(DRAM) and secondary(Hard Disk). Today, more important for protection vs another level of memory hierarchy. Each process thinks it has its own memory space to itself.

So, we have to distinguish Virtual address and Physical address.

Vritual address is used by the programmer to address memory within a process's address space.

Physical address is used by the hardware to access a physical memory location.

Virtual memory has illusion of having more physical memory. Virtual memory provides apperrance of very large memory. In short, it can think about that use memory only.

This picture shows the way to use virtual memroy. Some addresses in the virtual memory mapped with the physical memory address. However, the other addresses are mapped with the secondary storage. By doing so, we can use very big virtual memory.


Address Transration

Program uses the virtual addresses. It means that the addresses in the virtual memory mapped with the physical memory. By doing so, we can use the large and big memory.


This picture mentions the missing situations in the virtual memory. In the Operating System, Swap Memory in the OS and we can use it.

If the addresses are not missing, then we can use it to translate to physical addresses.

Page is a virtual memory block. Mapping from a virtual to physical address.

The virtual address = virtual page number + page offset
The physical address = physical page number + page offset.

The translation process is already defined in the Operating System. So, we can use it.


Page fault is a situation that missing in the virtual memory. The data is not in the virtual memory, retrieve it from disk. Its time cost is long, so it is important to reduce the page faults.
We can handle the faults in software instead of hardware. In this situation, using write-through scheme is too expensive, so we have to use write back.


We can see the structure about the virtual memory. In the page table, we can see the valid bit in the virtual pages. By using it, we can know about the position of this page's address.

There is a page table register, we can points to the start of page table.


Traslation Lookaside Buffer(TLB) is a special cache for address translations. This is a type of cache and we can put it only physical memory addresses. By using TLB, we can improve our virtual memory's performance.

profile
안녕하세요 :)

0개의 댓글