Functions of memory manager Allocates primary memory to processes. Maps process address space to primary memory.
Two Marks Questions with Answers
Q.1
State the function of memory manager.
Ans.
Functions of memory manager
•
Allocates primary memory to processes.
•
Maps
process address space to primary memory.
•
Minimizes
access time using cost-effective memory configuration.
•
May
use static or dynamic techniques
Q.2
Name two differences between logical and physical addresses.
Ans. A logical
address does not refer to an actual existing address; rather, it refers to an
abstract address in an abstract address space. Contrast this with a physical
address that refers to an actual physical address in memory. A logical address
is generated by the CPU and is translated into a physical address by the memory
management unit (MMU). Therefore, physical addresses are generated by the
Q.3
What is address binding?
Ans. The process of
associating program instructions and data to physical memory addresses is
called address binding, or relocation.
Q.4
What is memory?
Ans. Memory is a device used to store
the data and instructions required for any operation.
Q.5
What is called pages?
Ans. The address
space is usually broken into fixed-size blocks, called pages. Each page resides
either in main memory or on disk.
Q.6
Explain the consequences of swapping.
Ans.
a. Context switching time is fairly
high.
b. Only idle process must swap.
c. Transfer time is directly
proportional to the amount of memory swapped.
d.
It increase the O.S. overheads.
Q.7
What is an overlay? What is the use of it?
Ans. It allows a process to execute
despite to the system having insufficient physical memory. The idea of overlay
is to keep in memory only those instructions and data that are needed at any
given time. When other instructions are needed, they are loaded into space that
was occupied previously by instructions that are no longer needed. Overlay do
not require any special support from the operating system.
Q.8
What is internal fragmentation?
Ans. Internal
fragmentation exists when the smallest available block is larger than the
requested memory. It is the memory which is internal to a partition, but is not
being used.
Q.9
Distinguish between internal and external fragmentation.
Ans. Internal
fragmentation is the area in a region or a page that is not used by the process
it is allocated to. The space is wasted until the process terminates. External
fragmentation occurs when there is enough free space to satisfy a request for
memory, but none of the free holes between processes in memory is large enough
to satisfy the request.e
Q.10
Bring out the disadvantages of fixed partition multiprogramming.
Ans.
Disadvantages of fixed partition multiprogramming
a. Limited degree of multiprogramming.
b. Internal fragmentation.
c. Placement policies.
Q.11
What are memory pages and segments?
Ans. Logical memory is also broken into
blocks of the same size called pages. It divides a program into a smaller block
called segments, each of which is allocated to memory independently.
Q.12
What are the consequences of multiprogramming with fixed partitioning and
variable partitioning?
Ans.
1. Fixed partitioning
• Advantages
i) Simple to implement.
ii) Overhead is less.
• Disadvantages
i) Suffer from
internal fragmentation.
ii) Inefficient use of memory.
2. Variable partitioning
• Advantages
i) Multiprogramming.
ii)
Better utilization of processor and I/O devices.
iii)
Easy to implement.
• Disadvantages
i) Fragmentation.
ii) Require contiguous memory location.
iii) Some memory may never be utilized.
Q.13 Explain
how memory can be dynamically allocated using first fit, best fit and worst fit
strategies.
Ans.First fit: Take
the first available hole in memory that is of adequate size. Fast but leads to
fragmentation.
Best fit: Take the hole that most
closely matches (atleast as big as) the size of the program. Usage efficient
but slow still leads to fragmentation.
Worst fit : Take the biggest possible
hole. Aims to reduce the number of little and wasted memory holes. Still leads
to fragmentation.
Q.14
Describe non-contiguous memory allocation.
Ans. For N memory
blocks, the loss of 0.5 N blocks is possible due to external fragmentation.
This means that one-third of memory is not usable. But compaction is too costly
to perform regularly. External fragmentation arises because we are trying to
allocate memory contiguously. We can deal with external fragmentation if we can
allow process memory to be non-contiguous.
Q.15
What are the disadvantages of single contiguous memory allocation ?
Ans.
Disadvantages:
1. Memory is not fully utilized. 2. Poor
utilization of processors.
Q.16
Define external fragmentation ?
Ans.
Total memory space exists to satisfy a
request, but it is not contiguous; storage is fragmented into a large number of
small holes.
Q.17
What is a page ?
Ans. Divide logical memory into blocks
of same size called pages.
Q.18
What is frame table ?
Ans. Allocation and
availability of the frame information is kept in a data structure called a
frame table. Frame table has one entry for each physical page frame, indicating
whether the latter is free or allocated and if it is allocated, to which page
of which process or processes.
Q.19
Define zero level paging.
Ans. There is no paging is used. The TLB
is large enough to hold all the entries which is required for processing.
Q.20 What is the purpose of paging the
page tables ?bbe
Ans. In certain
situations the page tables could become large enough that by paging the page
tables, one could simplify the memory allocation problem (by ensuring that
everything is allocated as fixed size pages as opposed to variable sized
chunks) and also enable the swapping of portions of page table that are not
currently used.
Q.21
Explain the advantages of inverted page tables.
Ans.
Advantages
1.
It decreases the amount of memory needed to store each page table.
2. It limit the search using TLB.
3. Separate hardware is not required.
Q.22
What is a translation look aside buffer used for?
Ans.
Problem
with paging is that, extra memory references to access translation tables can
slow programs down by a factor of two or three. Too many entries in translation
tables to keep them all loaded in fast processor memory. To solve this problem
TLB is used. TLB is used to store a few of the translation table entries.
Q.23
Why should paging be used by operating systems ?
Ans.
Paging permits the physical address space of process to be non-contiguous.
Discuss the salient features and merits of multilevel paging and inverted page
tables.
Q.24
Features and merits of multilevel paging
Ans.
1.
It solves the problem of large logical address space.
2. Operating system can leave partitions
unused until a process needs them.
3.
It reduces main memory use.
Features
and merits of inverted page tables
1.
It decreases the amount of memory needed to store each page table.
2. Associative memory access is very
fast which is used in inverted page table.
Q.25
Explain what the use of a page table is and how it is used.
Ans. Use of page
table,
1.
It shows the frame location for each page of the process.
2. Processor uses page table to produce
a physical address.
Q.26
What is page frame?
Ans. Physical memory unit is called page
frame.
Q.27 Consider a logical address space of
eight pages of 1024 words each, mapped onto a physical memory of 32 frames. How
many bits are there in the logical address and in the physical address.
Ans. Addressing within a 1024-word page
requires 10 bits because 1024 = 210. Since the logical address space
consists of 8 = 23 pages, the logical addresses must be 10+ 3 = 13
bits. Similary, since there are 32 = 25 physical pages, physical
addresses are 5+10 15 bits long.
Q.28
Why are pages sizes always powers of 2 ?
Ans. Paging is implemented by breaking
up an address into 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.
Q.29
Define swap space.
Ans. Secondary 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 disk used for
this purpose is known as swap space.
Q.30
What do you mean by page fault?
Ans. A page fault is a trap to the
software raised by the hardware when a program accesses a page that is mapped
in the virtual address space, but not loaded in
Q.31
Define TLB.
Ans.: TLB is the memory cache of the most
recently used memory management unit.
Q.32
Name the dynamic memory allocation techniques based on size.
Ans: Segmentation.
Q.33
What is segmentation ?
Ans. Segmentation
divides a program into a number of smaller blocks called segments.
Q.34
Explain the type of fragmentation present in paging and segmentation systems.
Ans. Paging:
Internal fragmentation.
Q.35
Why are segmentation and paging sometimes combined into one scheme?
Ans. Segmentation and paging are often
combined in order to improve upon each other. Segmented paging is helpful when
the page table becomes very large. A large contiguous section of the page table
that is unused can be collapsed into a single segment table entry with a page
table address of zero. Pages segmentation handles the case of having very long
segments that require a lot of time for allocation. By paging the segments, we
reduce wasted memory due to external fragmentation as well as simplify the
allocation.
Q.36
Why should we use virtual memory ?
Ans. Virtual memory allows execution of
partially loaded processes.
Q.37
What is virtual memory? Mention its advantages.
Ans. Virtual memory is a technique that
allows the execution of processes that are not completely in memory. Advantage
of virtual memory is that programs can be larger than physical memory.
Q.38
What happens if the process tries to use a page that was not brought into
memory?
Ans. Access to a page
marked invalid causes a page-fault trap. Invalid bit indicates that the page
either is not valid (not in logical address space) or is valid but is currently
on the disk.
Q.39
Consider a memory system with a cache access time of 10ns and a memory access
time of 110ns assume the memory access time includes the time to check the
cache. If the effective access time is 10% greater than the cache access time,
what is the hit ratio H? AU CSE: May-17
Ans. Effective Access Time = H × Tcache
+ (1-H) × Tmemory
1.1
× Tcache = H × Tcache + (1-H) × Tmemory
1.1
× 10 = H × 10 + (1 - H) 110
11
= H × 10 + 110 - 110 × H
- 99 = -100 H
H
= 99/100
H
= 0.99
Q.40
What is a difference between instruction? Which of the following instructions
should be privileged and only allowed to execute in kernel mode ?
a
user-level instruction and a privileged
(a)
User level instruction
(b)
privileged instruction
Ans. A privileged instruction is an
instruction that can only be executed in kernel mode. User level instruction is
executed in user area.
Q.41 What
is demand paging ?
Ans.
: Determines when a page should be
brough into memory. Demand paging only brings pages into main memory when a
reference is made to a location on the page.
Q.42
What is meant by Belady'sanomaly ?
Ans.
For
some page replacement algorithms, the page fault rate may increase as the
number of allocated frames increases.
Q.43
What is optimal page replacement ?
Ans. The optimal policy selects for
replacement the page that will not be used for longest period of time.
Q.44 Differentiate
between global and local page replacement algorithms.
Ans. Global page
replacement considers all unblocked pages in main memory as candidates for
replacement regardless for which process owns a particular page. Local page
replacement chooses only among the resident pages of the process that generated
the page fault in selecting a page to replace.
Q.45
What is the key distinction between FIFO and optimal algorithms ?
Ans. The key
distinction between FIFO and optimal algorithms is that FIFO uses the time when
a page was brought into memory; the optimal uses the time when a page is to be
used (future).
Q.46
Define a cache hit.
Ans. When the CPU refers to memory and
finds a required word in cache it is termed as cache hit.
Q.47 Define
hit ratio.
Ans. The ratio of the number of hits
divided by the total CPU references to memory is the hit ratio.
Q.48
Define a miss.
Ans. When the CPU
refers to memory and if the required word is not found in cache it is termed as
miss.
Q.49
Write a formula for average memory access time.
Ans. Average memory
access time = Hit time + Miss rate x Miss penalty
Q.50 Mention
the significance of LDT and GDT in segmentation.
Ans. A descriptor table is simply a
memory array of 8-byte entries that contain descriptors. The Local Descriptor
Table (LDT) is a memory table used in protected mode and containing memory
segment descriptors. The Global Descriptor Table is a data structure used in
80286. A: anA
Q.51 Will optimal page replacement
algorithm suffer from Belady's anomaly? Justify your answer. AU: CSE: May-17
Ans. Optimal replacement never suffers
from Belady's anomaly. It was always believed that an increase in the number of
page frames would always result in the same number or fewer page faults.
Q.52
Consider the following page-reference string 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12. How many page faults ratio would occur for the FIFO page replacement
algorithm? Assuming three is four frames.
page faults = 12 page faults ratio = 100%
Q.53
What are the counting based page replacement algorithms ?
Ans. Counting-based page replacement
algorithms are least frequently used (LFU) and most frequently used (MFU).
Q.54
How do you limit the effects of thrashing?
Ans. To limit the effect of thrashing
we can use local replacement algorithm. With local replacement algorithm, if
the process starts thrashing, it cannot steal frames from another process and
cause the latter to thrash as well. The problem is not entirely solved.
Q.55
What is temporal locality ?
Ans: Recently
referenced items are likely to be referenced again in the near future. This is
often caused by special program constructs such as iterative loops, process
stacks, temporary variables or subroutines.
Q.56
Define spatial locality.
Ans:
This
refers to the tendency for a process to access items whose addresses are near
one another.
Q.57
What do you mean by 'Thrashing' ?
Ans: It is a
situation in which a process is spending more time paging than executing.
Q.58
How does the system detect thrashing ?
Ans: The system can
detect thrashing by evaluating the level of CPU utilization as compared to the
level of multiprogramming.
Q.59
Consider the following segmentation table.
What
are the physical addresses for the logical addresses 3400 and 0110? AU CSE/IT:
May-19
Ans.
:
Logical
address 3,400 :
Segment = 3, offset = 400, length = 580
Physical
address = offset + base = 400 + 1327
Physical address = 1727
Logical
address 0, 110:
Segment = 0, offset = 110, length = 600
Physical
address = offset + base = 110 + 219
Physical
addrres = 329
Q.60
What is thrashing and how to resolve this problem? AU CSE/IT: May-19
Ans. 'Thrashing'
It is a situation in which a process is spending more time paging than executing.
Ans. To limit the effect of thrashing we can use local replacement algorithm. With local replacement algorithm, if the process starts thrashing, it cannot steal frames from another process and cause the latter to thrash as well. The problem is not entirely solved.
Introduction to Operating Systems: Unit III: Memory Management : Tag: : Memory Management - Introduction to Operating Systems - Two marks Questions with Answers
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation