Subscribe by Email

Tuesday, February 2, 2010

Where is swap space located ?

Virtual memory uses disk space as an extension of main memory. Since disk access is much slower than memory access, using swap space has a large effect on system performance.

Swap space can reside at two places :
- It can be carved out of the normal file system : In this case, normal file system routines can be used to create it, name it, and to allocate its space. This approach is easy to implement but inefficient because navigating the directory structure and data structures takes time, and extra disk access. In addition to this, external fragmentation greatly increases swapping times. Performance can be improved by caching the block location information in physical memory but the cost of traversing the file system data structures still remains.

- It can be on a separate disk partition : There is no directory structure or file system placed on this space, a separate swap-space storage manager is used to allocate and deallocate the blocks. This manager uses algorithms that are optimized for speed, rather than for storage efficiency. Internal fragmentation may increase but this is acceptable as data in swap space resides for much shorter period. This approach creates a fixed amount of swap space during disk partitioning, adding more space can only be done via repartitioning of the disk.

No comments:

Facebook activity