In: Computer Science
a) Explain how performance can be controlled in virtual memory.
(b) How does the OS implement dynamic allocation of frames?
c) Explain the main difficulty in using and/or managing virtual memory.
(a) Performance can be controlled in virtual memory by the following ways :
When large amounts of virtual memory are required, then we need to make the minimum and maximum sizes of virtual memory file identical. It also forces the operating system for allocating the entire paging file while starting of the machine. It keeps the paging file from growing while the program is running which could help in increasing the performance. Many of the video applications may recommend the same technique for avoiding pauses while reading or while writing the the information of video in hard disk and tape.
One more factor of the performance of virtual memory is location of a pagefile. If the system is having multiple physical hard drives, then the you would be able to spread the work with them for making the smaller pagefile on each of the drive. This modification would help in speed up the system which makes heavy use of the virtual memory.
(b) The process must allocate the frames for the current locality. If more of the frames gets allocated to then there is some little improvement. If less frames are been allocated then there may be very high page fault rate. The dynamic paging would be using the locality model ie., and the set of pages used for the particular phase of computation. The page frames are dynamically allocated to the among the process that is the page frames of a process would vary. As the process working set grows and it also shrinks, the it will be able to allocate more or less page frames.
It is implemented by using the Frame-Allocation Algorithms which will be deciding the number of frames which needs to be allocated for each process.
The ultimate Goal is for allocating enough frames to keep all pages used in the current locality of references without allocating too many page frames.
Implementation strategies:
EQUAL ALLOCATION: each number of the frames
would be evenly distributed through processes here . Not all that
useful as not every process would need an equivalent number of
frames; some processes would need some additional frames, while
some processes may require fewer frames.
For example, provided the number of frames: 6
No. of available processes: 3
As a result, each phase will have 2 frames
WEIGHTED ALLOCATION: Based on the size of the
operation, the number of the frames will be assigned accordingly.
More number of frames will be given the larger size of the process.
It is mostly used in contrast to other algorithms.
For example: available processes in size P1: 20 Pages, P2: 30
Pages, P3: 50 Pages
Frames available: 10
Requirements: P1=20/100 * 10=2.
P2=30/100 * 10=3
P3=50/100 * 10=5
PRIORITY ALLOCATION: Processes with the higher priority no. are more framed. If a higher-priority process requires more structures, it will override a lower-priority process aggressivel. Suppose the process P1 is having a higher priority than the process P2 and it requires more frame than P1 pulls out P2 and uses the frame.
The page replacement algorithms :
The Page Replacement Algorithm lets us determine which page should be replaced to get the lowest page fault rate, and this decision has a major impact on the performance of it.
Types:
LOCAL PAGE – REPLACEMENT: The local page replacement technique would work as a static allocation whenever its need to replace a page from the main memory, this might only replace the page from the frames assigned to that specific process and without disrupting any other pages of other processes.
GLOBAL PAGE-REPLACEMENT: This replacement method is different from the local page replacement strategy, while replacing every page that is required to be consider something to replace, it might consider replacing all the available frames.
(c) Problems in virtual memory
It would make the computer to run slower and because the processor
has to wait while the data is swapped between the hard disk and the
RAM. Here the secondary storage devices is having slower access
time than the RAM, the processing performance of the computer can
be severely impaired.
The applications do run very slowly when the system uses the
virtual memory. It takes more time for switching between the
applications. It also offers less hard drive space for the uses and
reduces the system stability.
Difficulties or disadvantages of using the virtual memory are: