Chapter 8 Virtual Memory · Real memory Main memory, the actual RAM, where a process executes Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory Size is limited by the amount of secondary memory available Virtual address is the address assigned to a location in virtual memory
1 Chapter 8 Virtual Memory • Real memory – Main memory, the actual RAM, where a process executes • Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory – Size is limited by the amount of secondary memory available • Virtual address is the address assigned to a location in virtual memory
Keys to virtual Memory 1)Memory references are logical addresses that are dynamically translated into physical addresses at run time a process may be swapped in and out of main memory, occupying different regions at different times during execution 2) A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory
2 Keys to Virtual Memory 1) Memory references are logical addresses that are dynamically translated into physical addresses at run time – A process may be swapped in and out of main memory, occupying different regions at different times during execution 2) A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory
Breakthrough in Memory Management If both of those two characteristics are present then it is not necessary that all of the pages or all of the segments of a process be in main memory during execution If the next instruction and the next data location are in memory then execution can proceed
3 Breakthrough in Memory Management • If both of those two characteristics are present, – then it is not necessary that all of the pages or all of the segments of a process be in main memory during execution. • If the next instruction and the next data location are in memory then execution can proceed
Execution of a process os brings into main memory a few pieces of the program Resident set: portion of process that is in main memory EXecution proceeds smoothly as long as all memory references are to locations that are in the resident set An interrupt(memory access fault is generated when an address is needed that is not in main memor
4 Execution of a Process • OS brings into main memory a few pieces of the program – Resident set: portion of process that is in main memory • Execution proceeds smoothly as long as all memory references are to locations that are in the resident set • An interrupt (memory access fault) is generated when an address is needed that is not in main memory
Execution of a process OS places the process in a blocking state Piece of process that contains the logical address is brought into main memory OS issues a disk l/o Read request Another process is dispatched to run while the disk lo takes place An interrupt is issued when disk l/o complete which causes OS to place the affected process in the Ready state
5 Execution of a Process • OS places the process in a blocking state • Piece of process that contains the logical address is brought into main memory – OS issues a disk I/O Read request – Another process is dispatched to run while the disk I/O takes place – An interrupt is issued when disk I/O complete which causes OS to place the affected process in the Ready state