Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
SSD2_Ex3.doc
Скачиваний:
12
Добавлен:
22.11.2019
Размер:
58.88 Кб
Скачать

Question 2. Virtual Memory

In this section, you will use a program demonstrating how virtual memory is used.

a. How does virtual memory work using a page table?

Answer: In virtual mode, every address is "translated" into a physical memory location by means of a page table. For each page in the virtual address space, the page table gives the real address in RAM where the page is located.

b. What is the primary purpose of virtual memory?

Answer: In order to increase program flexibility.

c. List three advantages of using virtual memory when executing a program.

Answer: 1.The most important is process isolation.

2. Another advantage of virtual memory is that the address space the processes see can actually be larger than the physical memory available.

3. We need not worry about how much physical memory is on the machine. We have an entire virtual address space to use as they like, and the kernel takes care of the implementation details.

Execute the Page Replacement Simulation program. Click on Paging.exe to run the application. Refer to Appendix A. Running a Visual Basic File if Paging.exe does not run.

Notice the top of the program window indicates the number of request and total page faults. The table on the left represents RAM and the one on the right represents the hard disk. The order of requests is set at default. You can also enter your own order of requests. To change the speed of the simulation, you can use the speed adjuster at the bottom-left of the program window. Each time you click on Stop or Pause, the simulation ends after one complete memory access.

Start the program using the default queue of requests.

d. Describe what is happening for the first seven requests step-by-step for the default order of requests.

Answer: Six page faults occurred. It means five requests is in virtual memory. The computers first take it to RAM and then send it to CPU.

e. When does a page fault occur, and how does the kernel handle a page fault?

Answer: The address translation circuitry checks the page table, finds the "not in RAM" marker, and generates a page fault. This is a kind of interrupt. The processor stops executing the user program and gives control to the kernel. The kernel looks at certain status registers to figure out where the page fault came from and says, "Oh, this process wants access to its virtual page seven. I will get some RAM here and load in page seven of the program. Now I will fix update the page table, and I will let the program the instruction again." So, control is returned to the user program, and the program continues as if nothing unusual had happened.

f. Enter a sequence of eight requests in place of the default order of requests in the program that would cause four page faults.

Answer: 2,3,4,1,2,1,3,4

g. In what case is it undesirable to use virtual memory?

Answer: The speed is very low.

h. Given a total paging file size of 267MB, and a RAM of size 256MB. Your applications are currently taking up 500MB of memory. How would you run an application that consumes 100 MB of memory?

Answer: Expand the virtual memory.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]