The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+10 votes

What is the swap space in the disk used for?

  1. Saving temporary html pages

  2. Saving process data

  3. Storing the super-block

  4. Storing device drivers

asked in Operating System by Veteran (59.5k points)
retagged by | 1.3k views

5 Answers

+12 votes
Best answer

Swap space( on the disk) is used by Operating System to store the pages that are swapped out of the memory due to less memory available on the disk. Interestingly the Android Operating System, which is Linux kernel under the hood has the swapping disabled and has its own way of handling "low memory" situations.

Pages are basically Process data, hence the answer is (B).

answered by Active (2.8k points)
edited by

Hi @sandeep007734 ji,

How is "low memory" situation handled in Android when swapping is disabled. Cloud you please provide some reference ?


An interesting, though old, read here:

Main points why SWAP does not make sense in Android:

1. In Desktop environment, swap space is used when the OS is running out of physical memory and it decides to use a small of part of HDD to act as slow memory. In desktop, there are many ideal processes and the eviction policy to swap will move their pages to swap. This results in marginally degraded performance which users hardly notice. However, in Android, most of the processes are active and hence the user will notice the difference.

2. SD card are very very slow ( compared to HDD and hence the SWAP performance wil be very poor.

So, in Android if the OS runs out of memory it just kills the process. However, it notifies the process that it is about to be killed (using callback methods) and it should save important data to persistent memory.

+5 votes
Answer is b.
answered by Active (3.3k points)
+5 votes

Swap space is a portion of a hard disk drive (HDD) that is used for virtual memory. Virtual memory is the use of space on a HDD to simulate additional main memory. Memory is used to hold portions of the operating system, programs, and data that are currently in use.

Show answer is B because of process save program, data in virtual memory.

answered by Active (1.9k points)
+4 votes

Swapping is now combine with virtual memory technique. In fact some system now use paging and swapping interchangeably.
Virtual memory uses disk space as an extension of main memory. Since disk access is much slower than memory access, using swap space significantly decreases system performance. The main goal of swap space is to provide best throughput for the virtual memory system.
So, A,C,D ruled out
Ans B) better option than other three

answered by Veteran (92.1k points)
+3 votes

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

answered by Junior (503 points)

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,174 questions
45,676 answers
49,562 users