Log In
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
retagged by

5 Answers

25 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).

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.

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

5 votes
Answer is b.
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.

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


Related questions

25 votes
2 answers
Increasing the RAM of a computer typically improves performance because: Virtual Memory increases Larger RAMs are faster Fewer page faults occur Fewer segmentation faults occur
asked Sep 22, 2014 in Operating System Kathleen 17.1k views
45 votes
9 answers
Consider a disk drive with the following specifications: $16$ surfaces, $512$ tracks/surface, $512$ sectors/track, $1$ KB/sector, rotation speed $3000$ rpm. The disk is operated in cycle stealing mode whereby whenever one $4$ byte word is ready it is sent to memory; similarly, ... is $40$ nsec. The maximum percentage of time that the CPU gets blocked during DMA operation is: $10$ $25$ $40$ $50$
asked Sep 22, 2014 in CO and Architecture Kathleen 17.6k views
17 votes
2 answers
Consider a relation scheme $R = (A, B, C, D, E, H)$ on which the following functional dependencies hold: {$A \rightarrow B$, $BC \rightarrow D$, $E \rightarrow C$, $D \rightarrow A$}. What are the candidate keys R? $AE, BE$ $AE, BE, DE$ $AEH, BEH, BCH$ $AEH, BEH, DEH$
asked Sep 22, 2014 in Databases Kathleen 3.3k views
49 votes
6 answers
The relation book (title,price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? select title from book as B where (select count(*) from book as T where T.price ... four most expensive books Title of the fifth most inexpensive book Title of the fifth most expensive book Titles of the five most expensive books
asked Sep 22, 2014 in Databases Kathleen 12.2k views