Unit3-2m and 14m QB

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

UNIT-III

TWO MARKS

1. Differentiate external and internal fragmentation. [Nov/Dec 2013]


Internal fragmentation External fragmentation
Internal fragmentation exists when memory External fragmentation exists when enough
that is internal to a partition but it is not used. total memory space exists to satisfy a request,
but it is not contiguous; storage is fragmented
into large number of small holes.

2. Consider a logical-address space of eight pages of 1,024 words each, mapped onto a
physical memory of 32 frames. [May/June 2013] [May/June 2012] .[April/may
2009]
a. How many bits are in the logical address?
b. How many bits are in the physical address?
Logical address: 13 bits
Physical address: 15 bits

3. What is Belady’s anomaly? [May/June 2013]


Define Belady’s anomaly. [Nov/Dec 2011]
For some page-replacement algorithms, the page fault rate may increase as the number of
allocated frames increases. This unexpected result is known as Belady's anomaly.

4. What is the advantage of demand paging? [May/June 2012]


It decreases swap time and the amount of physical memory needed.
5. What are the disadvantages of single contiguous memory allocation? [Nov/Dec 2011]
• it suffers from external fragmentation
• it suffers from internal fragmentation
6. What is demand paging? [Nov/Dec 2011]
Virtual memory is commonly implemented by demand paging. In demand paging, the
pager brings only those necessary pages into memory instead of swapping in a whole process.
Thus it avoids reading into memory pages that will not be used anyway, decreasing the swap
time and the amount of physical memory needed.
7. Explain dynamic loading. [Nov/Dec 2011]
To obtain better memory-space utilization dynamic loading is used. With dynamic
loading, a routine is not loaded until it is called. All routines are kept on disk in a relocatable
load format. The main program is loaded into memory and executed. If the routine needs another
routine, the calling routine checks whether the routine has been loaded. If not, the relocatable
linking loader is called to load the desired program into memory.

8. What is address binding? [Nov/Dec 2010]


Address binding is a mapping of one address space to another. Addresses in source program are
symbolic. A compiler binds these symbolic addresses to relocatable addresses. The linkage editor
or loader binds these relocatable addresses to absolute addresses.

9. What do you mean by page fault? [Nov/Dec 2010]


A process executes and accesses pages that are memory resident. If a process tries to
access a page that was not brought into memory, then it is called page fault.

10. What is meant by segmentation? [Nov/Dec 2010]


Segmentation is a memory management scheme that permits physical address space to be
non-contiguous. Logical memory is broken into variable sized blocks called segments.

11. What is thrashing? [Nov/Dec 2010]


Define thrashing.[April/may 2009]
The high paging activity is called paging. A process is thrashing if it is spending more
time in paging than executing
12. Why are page sizes always powers of 2?
The selection of a power of 2 as a page size makes the translation of a logical address into
a page number and page offset easy.
Paging is implemented by breaking up an address into a page and offset number. It is most
efficient to break the address into X page bits and Y offset bits, rather than perform arithmetic on
the address to calculate the page number and offset. Because each bit position represents a power
of 2, splitting an address between bits results in a page size that is a power of 2.

13. State few scenarios for the occurrence of page faults?[May/June 2006]
A page fault occurs when an access to a page that has not been brought into main
memory takes place. The operating system verifies the memory access, aborting the program if it
is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into
the free frame. Upon completion of I/O, the process table and page table are updated and the
instruction is restarted.

14. Define logical and physical address.[May/June 2006]


An address generated by the CPU is referred as logical address. An address seen by the
memory unit that is the one loaded into the memory address register of the memory is commonly
referred to as physical address.

15. Differentiate segmentation and paging.


Paging Segmentation
Logical memory is broken into same sized Logical memory is broken into variable sized
blocks called pages. blocks called segments.
Internal fragmentation occurs No Internal fragmentation
No external fragmentation Cause External fragmentation
Uses static memory allocation. Dynamic memory allocation is used.

16. Name two differences between logical and physical addresses. [UQ]
Logical address Physical Address
A logical address does not refer to an actual A physical address that refers to an actual
existing address. It refers to an abstract physical address in memory
address in an abstract address space
A logical address is generated by the CPU Physical addresses are generated by the MMU
and is translated into a physical address by the
memory management unit(MMU).

17. What is logical address space and physical address space?


The set of all logical addresses generated by a program is called a logical address space;
the set of all physical addresses corresponding to these logical addresses is a physical address
space.
18. What is the main function of the memory-management unit?
The runtime mapping from virtual to physical addresses is done by a hardware device
called a memory management unit (MMU).

19. Define dynamic linking.


Dynamic linking is similar to dynamic loading, rather that loading being postponed until
execution time, linking is postponed. This feature is usually used with system libraries, such as
language subroutine libraries. A stub is included in the image for each library-routine reference.
The stub is a small piece of code that indicates how to locate the appropriate memory-resident
library routine, or how to load the library if the routine is not already present.

20. What are the common strategies to select a free hole from a set of available holes?
The most common strategies are
• First fit
• Best fit
• Worst fit
21. Describe the difference between first-fit, best-fit and worst-fit dynamic storage
allocation strategies. [UQ]
First fit Best fit Worst fit
First fit allocates the first hole Best fit allocates the smallest Allocate the largest hole.
that is big enough. Searching hole that is big enough. The Again, we must search the
can either start at the entire list has to be searched, entire list, unless it is sorted
beginning of the set of holes unless it is sorted by size. by size. This strategy
or where the previous first-fit This strategy produces the produces the largest leftover
search ended. Searching can smallest leftover hole. hole, which may be more
be stopped as soon as a free useful than the smaller
hole that is big enough is leftover hole from a best-fit
found. approach.

22. What is required to support dynamic memory allocation in contiguous memory


allocation?[UQ]
First-fit, best-fit and worst-fit strategies are required to support dynamic memory
allocation in contiguous memory allocation.

23. What is compaction?


Compaction is a process to shuffle the memory contents to place all free memory together
in one large block.
24. Differentiate a page from segment. [UQ]
Page Segment
Logical memory is broken into same sized Logical memory is broken into variable sized
blocks called pages. blocks called segments.

25. What is the purpose of paging the page tables? [UQ]


If the page table size is very large, we use to page the page table in order to reduce the memory
use.
26. What is forward mapped page table?
The address translation of two level paging works from the outer page table inwards, this scheme
is called forward-mapped page table.

27. What are the advantages of having an inverted page table? [UQ]
Reduces the amount of memory used

28. What is Translation Look-aside Buffer used for? [UQ]


TLB is used to access the memory location faster. TLB is a high speed memory.

29. Define hit ratio.


The percentage of times that a particular page number is found in the TLB is called the
hit ratio.
30. Name the protection bits associated with paging.
• Read-only,read-write bit
• Valid-invalid bit
31. What is virtual memory?[UQ]
Virtual memory is a technique that allows the execution of processes that may not be
completely in memory. It is the separation of user logical memory from physical memory. This
separation provides an extremely large virtual memory, when only a smaller physical memory is
available.

32. Why should we use virtual memory? [UQ]


• To execute processes that may not be completely in main memory.
• To easily share files and address spaces
• Efficient mechanism for process creation
• To make the programming task easier because the programmer need not worry about the
physical memory available.

33. Define lazy swapper.


Rather than swapping the entire process into main memory, a lazy swapper is used. A
lazy swapper never swaps a page into memory unless that page will be needed.

34. What is a pure demand paging?


When starting execution of a process with no pages in memory, the operating system sets
the instruction pointer to the first instruction of the process, which is on a non-memory resident
page, the process immediately faults for the page. After this page is brought into memory, the
process continues to execute, faulting as necessary until every page that it needs is in memory.
At that point, it can execute with no more faults. This schema is pure demand paging.

35. Define effective access time.


Let p be the probability of a page fault (0<p<1). The value of p is expected to be close to
0; that is, there will be only a few page faults. The effective access time is
Effective access time = (1-p) * ma + p* page fault time.
ma → memory-access time

36. Define secondary memory.


This memory holds those pages that are not present in main memory. The secondary
memory is usually a high speed disk. It is known as the swap device, and the section of the disk
used for this purpose is known as swap space.

37. What is the basic approach of page replacement?


If no frame is free is available, find one that is not currently being used and free it. A
frame can be freed by writing its contents to swap space, and changing the page table to indicate
that the page is no longer in memory.
Now the freed frame can be used to hold the page for which the process faulted.

38. What are the major problems to implement demand paging?


The two major problems to implement demand paging is developing
• Frame allocation algorithm
• Page replacement algorithm

39. What is a reference string?


An algorithm is evaluated by running it on a particular string of memory references and
computing the number of page faults. The string of memory reference is called a reference string.

40. Define thrashing. How does the system detect thrashing and eliminates it?[UQ]
The high paging activity is called paging. A process is thrashing if it is spending more
time in paging than executing.

Detection:
Operating system monitors CPU utilization. If it is low, we increase the degree of
multiprogramming by introducing new process.
If global replacement algorithm is used, thrashing occurs.
Elimination:
If thrashing occurs, we should decrease the degree of multiprogramming.
Thrashing can be limited by using local replacement algorithm.

41. Write short notes on pre-paging? [UQ]


Prepaging brings into memory at one time all the pages that will be needed. It prevents
high level of initial paging.
42. What is modify or dirty bit?
Each page or frame may have a modify bit associated with it in the hardware. The modify
bit for a page is set by the hardware whenever any word or byte in the page is written into,
indicating that the page has been modified. When we select a page for replacement, we examine
its modify bit. If the bit is set, we know that the page has been modified since it was read in from
the disk. In this case, we must write that page to the disk. If the modify bit is not set, however, the
page has not been modified since it was read into memory.

43. What is working set?


The set of pages in most recent page references is called working set.

44. Differentiate equal and proportional allocation.


Equal allocation Proportional allocation
The available memory is equally allocated to Allocate available memory to each process
all process according to its size

16 MARKS
1. Explain the concept of demand paging and the performance issue of demand paging.(8)
[Nov/Dec 2013]
Explain the concept of demand paging. How can demand paging be implemented with virtual
memory?(16) [Nov/Dec 2010]
2. Explain the concept of paging in detail with necessary diagrams.(8) [May/June 2013]
Define paging.Explain the process address translation using paging.List out the pros and cons of
paging.(12) [Nov/Dec 2011]
3. Describe the hierarchical paging technique for structuring page tables.(8) [May/June
2013]
4. Explain any two page replacement algorithms.(8) [Nov/Dec 2013]
Consider the following page reference string: [May/June 2012]
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
How many page faults would occur for the following replacement algorithms, assuming one,
two, three,four,five,six and seven frames? Remember all frames are initially empty, so your first
unique pages will all cost one fault each.
• LRU replacement
• FIFO replacement
• Optimal replacement
5. Consider the following page reference string: 2,1,0,3,4,0,0,0,2,4,2,1,0,3,2. How many
page faults would occur if the working set policy were used with a window size of
4?Show when each page fault would occur clearly.(4) [May/June 2013]

Why should page replacement be performed? Compare FIFO, optimal and LRU page
replacement algorithms, with an example of your choice.(16) [Nov/Dec 2011]
6. Why are segmentation and paging sometimes combined into one scheme?(4) [May/June
2012]
Explain segmentation with paging? [Nov/Dec 2011]
Explain the principles of segmented and paged implementation of memory with a neat
diagram(16) [Nov/Dec 2013]
7. Given memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order) ,
how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212
KB, 417 KB, 112 KB, and 426 KB (in order)? Which algorithm makes the most efficient
use of memory? (16)[Nov/Dec 2010]
8. What is meant by thrashing? Discuss in detail.(12) [May/June 2013]
9. Explain segmentation memory management scheme(8) [Nov/Dec 2010]
10. Consider the following segment table(8) [May/June 2012] [Nov/Dec 2011]
Segment Base Length
0 219 600
1 2300 14
2 90 100
3 1327 580
4 1952 96
What are the physical addresses for the following logical addresses?
(1)0,430 (2)1,10 (3)2,500 (4)3,400

You might also like