HOME Page

Course Code : CS-13
Course Title : Operating Systems
Assignment Number : MCA (6)-13/TMA/04

FREE Answer was provided by www.universalteacherpublications.com

 

Question 1: When virtual memory is implemented in a computing system. There are certain costs associated with the technique and certain benefits. Is it possible for the costs to exceed the benefits? If it is, what measures can be taken to ensure that this does not happen?

Answer. A process is executed only when it is entirely in the memory. But if a process is larger than memory, then will it execute? So virtual memory comes into the picture.

Most computers today have something like 32 or 64 megabytes of RAM available for the CPU to use. Unfortunately, that amount of RAM is not enough to run all of the programs that most users expect to run at once.

Virtual memory is technique that allows the execution of process that may not be completely in memory. One major advantage of this scheme is that programs can be larger than physical memory.

The following figure shows the virtual memory:

Benefits of physical memory:

  1. We can run more than one program, i.e., application at once.
  2. We can run larger application than physical memory.
  3. Application may launch faster because of file mapping i.e. swapping page from the disk in and out.

Virtual Memory -

Virtual memory is non-physical memory.

Windows uses virtual memory when it doesn't have enough "regular"
physical memory to preform a task. When it does this, Windows uses your hard drive to store information that normally would be put into your RAM memory. Here's an overly simplified example:

Let's say you have 32 mb of RAM available. Now, you load a program that takes up 20 mb, and another that takes up 22 mb. You need a total of
42 meg, but you only have 32 meg of actual RAM memory. However, both programs still run. What's happening?

Windows is using 10 mb of hard drive space to supplement your physical
32 meg of RAM.

Whenever you're using a lot of virtual memory, you're slowing your computer down (way the heck down). The best work around is to get more physical memory. I recommend 64 - 128 mb, depending on how many programs you run simultaneously.

Cost of Virtual memory:

  1. Application run slower due to moving information from RAM to disk and back to RAM again.
  2. It takes more time to switch between applications.
  3. Less hard drive space for our use because virtual memory sets aside a portion of hard drive the same size of what virtual memory is set to.
  4. Reduce system stability due to high page fault.

For making system stable, application run faster, reduce time in switch application use some page replacement technique. In page replacement technique, pages are allocated to frame for swapping in and out. We use frame allocation algorithm to allocate page to a frame.

Question 4: Discuss the similarities and differences between the basic strategies for non-contiguous allocation of disk space.

Answer. Memory management is done in two ways. First is contiguous memory allocation. Memory is usually divided into two partitions – low memory and high memory. Since interrupt vector reside in low memory, so operating system is also placed in low memory.

And second is non-contiguous allocation of disk space. Non-contiguous allocation of disk space is done in two manner:

  1. Paging:- Paging is a memory management scheme that permits the physical address space of a process to be non-contiguous.
  2. Segmentation:- Segmentation is a memory management scheme that supports this year view of memory. A logical address space is collection of segments

Similarities and differences between basic strategy (i.e. paging and segmentation) for non-contagious allocation of disk space:-

Paging

Segmentation

1. Main memory partitioned into small fixed-size chunks called frames.
2. Program broken into pages by the compiler or memory management system

3. Internal fragmentation within frames.

4. No external fragmentation.

5. Operating system must maintain a page table for each process showing which frame each page contains.

6. Operating system must maintain a free frame list.

7. Processor uses page number, offset to calculate absolute address.

8. all the pages of the process must be in main memory for process to run, unless overlays are used.

9. Not all pages of the process need be in main memory frames for the process to run. Pages may be read in as needed.

10. Reading a page into main memory may require writing a page out of disk.

1.main memory not partitioned.

2. Program segments specified by the programmer to the compiler/ i.e. the decision is made by the programmer.

3. No internal fragmentation.

4. External fragmentation.

5. Operating system must maintain a segment table for each process showing the load address and length of each segment.

6. Operating system must maintain a list of free holes in main memory.

7. Processor uses segment number, offset to calculate absolute address.

8. All the segment of a process must be in main memory for process to run, unless overlays are used.

9. Not all segment of process need be in main memory frames for the process to run. Segments may be read in as needed.

10. Reading a segment into main memory may require writing one or more segments out to disk.

IGNOU Students Must VISIT www.universalteacherpublications.com