Skip to main content

Answer Chapter 3

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.
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

Popular posts from this blog

2.1.4 Distinguish between logical I/O and physical I/O

2.1.4 Distinguish between logical I/O and physical I/O logical input relate to hard disk Logical I/O an Physical I/O Physical" I/O is an actual fetch of data from a storage device such as a disk. Logical" I/O is a programmatic request for data satisfied by a memory (block, buffer) access. A logical I/O may cause a physical I/O in the first place, or a logical I/O may retrieve a part of a block (buffer) of data from memory. 2.1.5 Distinguish between directory management and disk space management. Directory management A directory is a hierarchical collection of directories and files.  The only constraint on the number of files that can be contained in a single directory is the physical size of the disk on which the directory is located. Disk management A hard disk is a rigid disk inside a computer that stores and provides relatively quick access to large amounts of data. It is the type of storage most often used with Windows. The system also supp

3.1.1 Identify Between Resident And Transient Routines

Memory Management Memory management is concerned with managing: The computer’s available pool of memory Allocating space to application routines and making sure that they do not interfere with each other. 3.1.1 Identify between resident and transient routines The operating system is a collection of software routines. Resident routines Transient routines Routines that directly support application programs as they run Stored on disk and read into memory only when needed Example: routine that control physical I/O Example: routine that formats disks The operating system occupies low memory beginning with address 0. Key control information comes first followed by the various resident operating system routines. The remaining memory, called the transient area, is where application programs and transient operating system routines are loaded. Resident & transient routines structure

Operating Systems Definition and the Classification of OS

             OPERATING SYSTEMS ( OS ) What is an operating system? An operating system (sometimes abbreviated as "OS") is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer. The other programs are called applications or application programs. The application programs make use of the operating system by making requests for services through a defined application program interface (API). In addition, users can interact directly with the operating system through a user interface such as a command language or a graphical user interface (GUI). An operating system performs these services for applications:     In a multitasking operating system where multiple programs can be running at the same time, the operating system determines which applications should run in what order and how much time should be allowed for each application before giving another application a turn.     It manages the sharing of