官术网_书友最值得收藏!

Virtual memory

The memory consists of lots of boxes, each of which is able to store a specified amount of data. We will refer to these boxes as memory cells, considering that each cell can store 1 byte representing 8 bits. Each memory cell is unique even if they store the same value. The uniqueness is achieved by addressing the cells so that each cell has its unique address in the memory. The first cell has the address 0, the second cell 1, and so on. 

The following diagram illustrates an excerpt of the memory, each cell with its unique address and ability to store 1 byte of data:

The preceding diagram can be used to abstractly represent both physical and virtual memories. The point of having an additional layer of abstraction is the ease of managing processes and providing more functionality than with physical memory. For example, OSes can execute programs greater than physical memory. Take a computer game as an example of a program taking almost 2 GB of space and a computer with a physical memory of 512 MB. Virtual memory allows the OS to load the program portion by portion by unloading old parts from the physical memory and mapping new parts. 

Virtual memory also better supports having more than one program in memory, thus supporting parallel (or pseudo-parallel) execution of multiple programs. This also provides efficient use of shared code and data, such as dynamic libraries. Whenever two different programs require the same library to work with, the single instance of the library could exist in memory and be used by both programs without them knowing about each other. Take a look at the following diagram, which depicts three programs loaded into memory:

There are three running programs in the preceding diagram; each of the programs takes up some space in virtual memory. My Program is fully contained in the physical memory while the Calculator and Text Editor are partially mapped to it.

主站蜘蛛池模板: 郎溪县| 兴宁市| 夹江县| 诏安县| 南平市| 桦南县| 宜兰市| 莲花县| 磐石市| 裕民县| 夏津县| 洮南市| 周口市| 屏边| 康定县| 邢台市| 灵台县| 汤原县| 荆门市| 中阳县| 桂东县| 陇南市| 浦东新区| 南召县| 柞水县| 昌图县| 奉化市| 石门县| 筠连县| 宜宾市| 盐边县| 忻城县| 湛江市| 北流市| 大竹县| 宜昌市| 黄石市| 阿克| 香港 | 珠海市| 玉门市|