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

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.

主站蜘蛛池模板: 乾安县| 咸阳市| 天津市| 迁安市| 阜阳市| 岗巴县| 五常市| 上高县| 镇坪县| 龙海市| 荔波县| 辽源市| 平乐县| 商洛市| 阿坝| 辽宁省| 确山县| 普定县| 延川县| 莎车县| 大同市| 建平县| 石楼县| 翁牛特旗| 乌拉特前旗| 万安县| 宁陵县| 长乐市| 通辽市| 景谷| 汉阴县| 兰州市| 开封市| 新昌县| 彩票| 寻甸| 申扎县| 龙海市| 和田县| 衡南县| 曲周县|