The Gateway to Computer Science Excellence
+16 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

in Operating System by Veteran (52.2k points)
retagged by | 2.5k views

5 Answers

+23 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).

by Active (3.1k 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.

+7 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.

by Active (2.2k points)
+5 votes
Answer is b.
by Active (3.3k points)
+5 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.

by Junior (613 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

by Veteran (119k points)

Related questions

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
50,737 questions
57,385 answers
105,387 users