Vitrual Memory

What is Virtrual Memory?

Virtual memory is the seperation of user logical memory from physical memory.

Vitrual memory can be implemented via Demand Paging & Demand Segmentation.

Why do we need Virtual Memory?

  1. Code needs to be in memory to execute, but the entire code of program rarely used.
  2. Program no longer constrained by limits of physical memory.
  3. Program could be larger than physical memory

The advantages of Virtual Memory

  1. Only part of the program needs to be in memory for execution
  2. Logical address space can therefore be much larger than physical address space
  3. Allows address spaces to be shared by several processes
  4. Allows for more efficient process creation
  5. More programs running concurrently
  6. Less I/O needed to load or swap processes

Vitrual Address Space

  • The virtual memory address space for each process is sparse. Enables sparse address spaces with holes left for growth, dynamically linked libraries.
  • System libraries shared via mapping into vitual address space.
  • Shared memory (for inter-process communication) by mapping pages read-write into virtual address space.
  • Pages can be shared during fork( ), speeding process creation

Swapping:

Transfer process from Main Memory to the Backing Store (SWAP parition) and swapped back to the main memory.

What is the diiference between swapping and demand paging?

ComparisonPagingSwapping
BasicPaging allows the memory address space of a process to be noncontiguous.Swapping allows multiple programs to run parallelly in the operating system.
FlexibilityPaging is more flexible as only pages of a process are moved.Swapping is less flexible as it moves entire process back and forth between main memory and back store.
MultiprogrammingPaging allows more processes to reside in main memoryCompared to paging swapping allows less processes to reside in main memory.
  1. The basic difference between paging and swapping is that paging avoids external fragmentation by allowing the physical address space of a process to be noncontiguous whereas, swapping allows multiprogramming.
  2. Paging would transfer pages of a process back and forth between main memory, and secondary memory hence paging is flexible. However swapping swaps entire process back and forth between the main and secondary memory and hence swapping is less flexible.
  3. Paging can allow more processes to be in main memory than the swapping.

Reference

https://techdifferences.com/difference-between-paging-and-swapping-in-os.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值