When it comes to virtual memory, which of the following is true of "thrashing"?
-
It can be caused by poor paging algorithms
-
It is a natural consequence of virtual memory systems
-
It always occurs on large computers
-
It can always be avoided by swapping
EXPLANATION
With
virtual memory, which is illustrated in the accompanying figure, when
an operating system spends much of its time paging, instead of executing
application software, it is said to be thrashing.
true
In operating systems that
implement a virtual memory space the programs allocate memory from an
address space that may be much larger than the actual amount of RAM the
system possesses. The OS is responsible for deciding which programs
"memory" is in actual RAM. It needs a place to keep things while they
are "out". This is what is called "swap space", as the OS is swapping
things in and out as needed. When this swapping activity is occurring
such that it is the major consumer of the CPU time, then you are effectively thrashing.
You prevent it by running fewer programs, writing programs that use
memory more efficiently, adding RAM to the system, or maybe even by
increasing the swap size.
A page fault occurs when the memory access requested (from
the virtual address space) does not map to something that is in RAM. A
page must then be sent from RAM to swap, so that the requested new page
can be brought from swap to RAM. As you might imagine, 2 disk I/Os for a
RAM read tends to be pretty poor performance.
0 comments:
Post a Comment