Monday 4 May 2020

Swapping in memory management | Why operating system use Swapping ?

Swapping

Definition :

Swapping is a mechanism in which a process can be swapped temporarily out of main memory (or move) to secondary storage (disk) and make that memory available to other processes At some later time, the system swaps back the process from the secondary storage to main memory.



Why operating system use Swapping:

Technique used by the operating system to increase the utilization of the processor by moving some blocked process from the main memory to the secondary memory(hard disk).
To increase the degree of multi-programming in a system.

Standard Swapping:

 Standard swapping involves moving processes between main memory and a backing store.

 Backing store:


  • The backing store is commonly a fast disk
  •  It must be large enough to accommodate copies of all memory images    
  • The system maintains a ready queue consisting of all processes whose memory images are on the backing store .





Swapping on Mobile Systems:

Swapping is typically not supported on mobile platforms, for several reasons:
  • Mobile devices typically use flash memory in place of more spacious hard drives for persistent storage, so there is not as much space available.
  • Flash memory can only be written to a limited number of times before it becomes unreliable.
  • The bandwidth to flash memory is also lower.

  1. Apple's IOS asks applications to voluntarily free up memory

  • Read-only data, e.g. code, is simply removed, and reloaded later if needed.
  • Modified data, e.g. the stack, is never removed, but . . .
  • Apps that fail to free up sufficient memory can be removed by the OS.

    2.Android follows a similar strategy.

  • Prior to terminating a process, Android writes its application state to flash memory for quick restarting.

No comments:

Post a Comment