Question
Definition
1.
Explain memory management.
Answer
Memory management is the
functionality of an operating system which handles or manages primary memory.
It keeps track of each and every memory location either it is allocated to some
process or it is free.
Function
2.
Gives five functions of memory management.
Answer
a.
To keep track of which parts of memory are in
use and which parts are not in use.
b.
Coordinates how memory hierarchy is used.
c.
Allocate memory to processes when they need it
and deallocate it when they are done.
d.
Manage swapping between main memory and disk
when main memory is too small to hold all the processes.
e.
Managing the computer’s available pool of
memory, allocating space to application routines and making sure that they do
not interface with each other.
Resident Vs Transient Routine
3.
Differentiate
between resident and Transient Routine.
Answer
Resident Routine
|
Transient Routine
|
Refers to routine that stays in memory; the part of program must
remain in memory all the times
|
Refers to a routine that is loaded as needed
|
Instructions and data that remains in memory can be accessed instantly
|
Stored on disk and read into memory only when needed
|
Example: Windows operating system
|
Example: database programs, web browser, drawing application, paint
application, image editing programs and etc.
|
Fragmentation
4. Fragmentation problem always occurs
in the memory. Describe how it happens.
Answer
a. Fragmentation problem occur when
some memory is left vacant because not big enough to be occupied.
b. Fragmentation problem occur when
many little chunks space spread throughout memory.
Virtual Memory
5. Explain the meaning of virtual
memory.
Answer
It is a technique that
allows the execution of processes that are not completely in memory.
This is done by mapping
a large logical address space into a smaller physical memory.
6. Explain the concept of virtual
memory in operating system.
Answer
a. Allows execution of a process which
is greater than the available memory.
b. Allows an operating system to be
multitasking.
c. The ideal of virtual memory is that
not all processes should be in memory at one time.
d. Some of virtual memory models are
demand paging, swapping and shared virtual memory.
e. Real, or physical, memory exists on
HD inside the computer
f. Virtual memory, doesn’t physically
exist on a memory chip
g. It is an optimization technique and
is implemented by the operating system in order to give an application program
the impression that it has more memory than actually exists.
7. List the major function of virtual
memory system.
Answer
a. It manages virtual to physical
mapping of memory.
b. It manage the swapping of memory
between primary and secondary storage to optimize performance.
c. It handle requirements of shared
image between multiple users and processes.
8. Give three model of virtual memory
management.
Answer
a. Demand Paging
b. Swapping
c. Share Virtual Memory
Demand Paging
9. Explain the demand paging
Answer
The pages are only loaded when they are
demanded during program execution.
Virtual memory is
commonly implemented by demand paging that loads pages only as they are needed.
10. With an aid diagram explain the
concept of demand paging.
A demand paging system is similar to paging system with swapping where processes reside in secondary memory.
Program B is swapped in during program execution when it is
needed.
Share Virtual Memory
11. Explain the concept of share virtual
memory.
Answer
·
When
more than one process needs to access the same pages of physical memory, the
virtual memory manager makes special arrangements that allow processes to share
memory.
·
Sharing
memory can reduce the consumption of physical memory. For example, if 4
instances of an application are running at the same time, all 5 of the
applications can execute the same code. Only one copy of the code must be stored
in physical memory.
Swapping
12. Sketch
and explain the Swapping Virtual Memory.
Answer
Swapping
a.
The purpose of swapping is to access
data being stored in hard disk and to bring it into the RAM so that it can be
used by the application program.
b.
Remember that swapping is only necessary when
that data is not already in the RAM.
c.
Processes can be swapped temporarily out of
memory to a backing store and then brought back into memory for continued
execution:
·
Backing Store - fast disk large enough to accommodate
copies of all memory images for all users; must provide direct access to these
memory images.
·
Roll out, roll in - swapping variant used for
priority based scheduling algorithms; lower priority process is swapped out, so
higher priority process can be loaded and executed.
·
Major part of swap time is transfer time; total
transfer time is directly proportional to the amount of memory swapped.
·
Modified versions of swapping are found on many
systems, i.e. UNIX and Microsoft Windows.
13. Using
simple appropriate diagram, interpret the swapping process occur in virtual
memory.
Answer
Cache Memory
14. Define a cache memory.
Answer
a. It is a small portion of memory
that’s made accessible to a device located close to main memory.
b. It works as a temporary storage area
where recently used data kept.
c. It is a separate chip that can be
accessed faster than the page frames in main memory.
15. Explain three types of cache memory.
Answer
a. CPU cache
· A CPU cache is a cache used by the
central processing unit of a computer to reduce the average time to access
memory.
b. Disk cache
· A portion of RAM used to speed up
access to data on a disk. The RAM can be part of the disk drive itself.
c. Web cache
· A web cache is a mechanism for the
temporary storage (caching) of web documents, such as HTML pages and images, to
reduce bandwidth usage, server load, and perceived lag.
Cache Memory and Virtual
Memory
16. Cache memory has become increasingly
important since the 1990s. Illustrate the relationship between virtual memory, RAM
and cache in terms of speed and size by using diagram.
Answer
17. Differentiate between cache memory
and virtual memory.
Answer
Cache Memory
|
Virtual Memory
|
It is a type
of memory used to improve the access time of main memory
|
It is a memory management technique used to
efficiently use RAM
|
It resides between
the CPU and the main memory, and there can be several levels of
caches such as L1, L2 and L3
|
Providing a separate memory space for each program
that is even larger than the actual physical RAM
|
Costlier than RAM so
capacity used is very small.
|
Items in the physical RAM are transferred back and
forth with the hard disk.
|
Page Tables
18. Elaborate the process on how Page
Table method is carried out based on Diagram 1.
Diagram 1 Page Table
Answer
a. CPU will kept and execute the
logical address and refer to Page Table.
b. The OS stores its mappings of
virtual addresses to physical addresses into Page Table.
c. Page table kept in main memory, so
in this scheme every data/ instruction access requires two memory lookups, one
for the page table and then one for the actual instruction.
d. The CPU will add another frames in
conjunction producing a physical address located in physical memory.
Dynamic Address
Translation (DAT)
19. With aid diagram, interpret the
Dynamic Address Translation (DAT).
Answer
The
process of translating a virtual address during a storage reference into the
corresponding a real address.
20. Explain Paging Supervisor
Answer
a. It creates and manages page tables.
If the hardware raises a page fault exception, the paging supervisor accesses
secondary storage, returns the page that has the virtual address that resulted
in the page fault, updates the page tables to reflect the physical location of
the virtual address and tells the translation mechanism to restart the request.
b. When all physical memory is already
in use, the paging supervisor must free a page in primary storage to hold the
swapped-in page. The supervisor uses one of a variety of page replacement
algorithms such as least recently used to determine which page
to free.
Terminologies in memory management
21. Describe
four terminologies in memory management.
Answer
Fixed Partition MM
a.
Equal-size partitions:
·
Any process whose size is less than or equal to
the partition size can be loaded into an available partition.
·
If all partitions are full, the operating system
can swap a process out of a partition.
·
A program may not fit in a partition.
·
The programmer must design the program with
overlays.
b.
Main memory use is inefficient.
c.
Any program, no matter how small, occupies an
entire partition.
d.
This is called internal fragmentation.
Dynamic MM
a.
Partitions are of variable length and number.
b.
Process is allocated exactly as much memory as
required.
c.
Eventually get holes in the memory. This is
called external fragmentation.
d.
Must use compaction to shift processes so they
are contiguous and all free memory is in one block.
Segmentation MM
a.
All segments of all programs do not have to be
of the same length.
b.
There is a maximum segment length.
c.
Addressing consist of two parts - a segment
number and an offset.
d.
Since segments are not equal, segmentation is
similar to dynamic partitioning.
Paging MM
a. Partition
memory into small equal fixed-size chunks and divide each process into the same
size chunks.
b. The
chunks of a process are called pages and chunks of memory are called frames.
c. Operating
system maintains a page table for each process:
·
Contains the frame location for
each page in the process.
·
Memory address consist of a
page number and offset within the page.
22. Explain the following related to
memory management terminologies with ONE advantage.
a. Fixed – Partition memory management
b. Dynamic memory management
c. Segmentation
d. Paging
Answer
a. Fixed – Partition memory management
a. It divides the available space into
fixed-length partitions. Memory allocations space is decide before the actual
memory space is known.
b. Advantages: Design is simple
b. Dynamic memory management
a. The transient area is treated as a
pool of unstructured free space. When the systems load a particular program, a
region of memory just sufficient to hold a program is allocated from a pool.
b. Advantages: Program get an almost
appropriate size, relatively less space is wasted.
c. Segmentation
a. Programs is divided into segments
that are stored in non-contiguous memory. Variable-length block of data resides
in secondary memory. Every logical address is formed of a segment name and
offset within that segment and are determined using segment table.
b. Advantages: Allocating memory is
easy and cheap, Efficient swapping.
d. Paging
a. The programs is break into a fixed –
length pages and loaded in non-contiguous memory. Its important part of virtual
memory, allowing them to use disk storage for data that does not fit into
physical RAM.
b. Page is secure, easy to share
memories.
Dynamic Memory Management
23. With an aid diagram explain the
dynamic memory management.
Answer
a. The transient area is treated as a
pool of unstructured free space
b. When the system decided to load a
particular program, a region of memory just sufficient to hold the program is
allocated from the pool
c. Because a program gets only the
space it needs, relatively little is wasted.
d. It does not completely solve the
wasted space platform
Operating system
|
Other region
|
25 MB region
|
MB region
|
Unused 9MB fragment
|
MB region
|
24.
In dynamic memory management, a process is loaded into a free partition by using first fit, best fit or worst fit allocation algorithms, Interpret any two of these algorithms.
In dynamic memory management, a process is loaded into a free partition by using first fit, best fit or worst fit allocation algorithms, Interpret any two of these algorithms.
Answer
a. First fit: allocate the first free
partitions (hole) that is big enough. We can stop searching as soon as we find
free hole that is large enough
b. Best fit: Allocate the smallest hole
that is big enough. We must search the entire list, unless the list is kept
ordered by size. This strategy, produces the smallest left over hole.
c. Worst fit: Allocate the largest free
partition (hole). Again, we must search the entire list, unless it is sorted by
size. This strategy produces the largest leftover hole, which may be more
useful than the smaller leftover hole best fit approach.
Segmentation
25. “Segmentation is also described as
memory management scheme that supports user’s view of memory”. Interpret
statement above.
Answer
a. Based on the common practice by
programmers of structuring their program in modules.
b. Segmentation scheme: each job is
divided into several segment of different sizes. One for each module that
contains pieces that perform related function.
c. Main memory is no longer divided
into page frames because the size of each segment is different (some are larger
some are small).
d. When a program is compiled the
segment are set up according to the program’s structural modules.
26. Draw an example of segmentation
architecture.
Answer
Operating system
|
Other program
|
Program A, segment 0
|
Other program
|
Program B, segment 1
|
Other program
|
Program B, segment 1
|
Other program
|
27. Describe dynamic address translation
in segmentation.
Answer
To
dynamically translate a segment address to an absolute address.
a. Break the address into segment and
displacement portions
b. Use the segment number to find the
segment’s absolute entry point address in a program segment table
c. Add the displacement to the entry
point address.
Cache Memory and Main Memory
28. Illustrate
the cache and main memory and explain the cache operation.
Answer
a.
CPU requests contents of memory location.
b.
Check cache for this data.
c.
If present, get from cache (fast).
d.
If not present, read required block from main
memory to cache.
e.
Then deliver from cache to CPU.
f.
Cache includes tags to identify which block of
main memory is in each cache slot.
Comments
Post a Comment