OS TEST 2 With Complete Solution Latest Update
What need does memory management attempt to fulfill? - Solution 1. Relocation - A
process that has been swapped out to a disk can be relocated to a different memory
location than the one it was in previously.
2. Protection - protection of each process from unwanted interference caused by other
processes. That is, programs executing in other processes should not be able to
reference memory locations of process for reading/writing purposes without
permission, satisfied by the processor (hardware)
3. Sharing - Allowing a set of processes share the same area of main memory. Any
memory management system must allow controlled sharing of memory regions among
more than one process if so desired while not compromising protection
4. Logical organization - Most of the Logically dealing with user programs and data in
modular pieces- the OS and computer hardware have to be able to deal logically with
user programs and data as modules of some sort.
5. Physical organization- the form that information takes in the transfer of it between
main and secondary memory
Why is the ability to move processes around desirable? - Solution It is restrictive to say
that when a process is swapped back in, that it must be put back in the same memory
location it had previously.
Why doesn't the compiler prevent memory protection violations? Solution The OS
cannot know, beforehand, all the memory a program may refer to; even if it could, it
would be too time-consuming to check each program in advance for possible
memory-reference violations.
What are some reasons to allow two or more processes to all have access to a
particular region of memory? - Answer If a number of processes are executing the same
program it is advantageous to allow each process to access the same copy of the
program rather than to have its own copy. Processes that are cooperating on some task
may need to share access to the same data structure.
,What are the advantages of using unequal-size partitions in a fixed-partitioning scheme?
Solution Processes are assigned so as to minimize wasted memory within a partition
(internal fragmentation). Larger size programs can be accommodated without overlay.
What is the difference between internal and external fragmentation? - Answer Internal
fragmentation mean there is wasted space internal to a partition due to the fact that the
block of data loaded is smaller than the partition.
External fragmentation occurs when memory is allocated and a small piece is left over
that cannot be effectively used.
What are some of the differences between Logical, Relative, and Physical addresses? A
logical address is a name for the memory location independent of the actual assignment
of data to memory. A translation must be made to a physical address before the memory
access can be achieved.
A relative address is a special type of logical address, in which the address is specified
as a distance from some known point, called the origin, or base, which is usually a value
in a processor register. A physical address is an actual address in main memory.
What is the difference between a page and a frame? - Answer A page is a part of a
process while a frame is a part of memory.
What is the major distinction between a page and a segment? Solution Segmentation is
visible to the programmer and is offered as a convenience for organizing programs and
data whereas paging is invisible to the programmer.
What is the difference between simple paging, and virtual memory paging? - Solution
Whereas in simple paging, for a process to execute, all of its pages must be brought into
main memory. In virtual memory, pages are read in on demand. Also in virtual memory
paging, a read of a page into main memory could require a write of a page to disk.
Explain thrashing. - Answer Thrashing is when the system spends most of its time
swapping pieces of a process rather than executing instructions. To overcome this, the
OS essentially guesses which pieces are least likely to be used in the near future, based
on recent history, and will swap those out of main memory.
, Why is the principle of locality crucial to the use of virtual memory? -Solution The
principle of locality says that program and data references within a process tend to
cluster. The first fact above justifies the assumption, made in the preceding chapter,
that at any given time only small pieces of a process are in actual use. It also supports
the hope, expressed there, that intelligent guesses can be made about which pieces of a
process will be needed in the near future so as to avoid thrashing. These two things
combined mean that virtual memory is a concept that can be applied and is worth
implementing.
What might a page table entry consist of? Describe each field. - Solution The frame
number, indicates to the corresponding page in main memory.
A modify (M) bit, that indicates if the contents of the corresponding page have been
changed since the page was last loaded into main memory.
A present (P) bit, which says whether the corresponding page is in main memory or not.
What is the purpose of a translation lookaside buffer? - Answer To reduce the memory
access time of a virtual memory scheme. It acts as a cache for recently used page table
entries.
Briefly define the alternative page fetch policies. - Solution Demand paging - A page is
brought into main memory only when a reference is made to a location on that page.
Prepaging - Pages other than the one demanded by a page fault are brought in.
What is the difference between resident set management and page replacement policy?
- Answer Resident set management - how many page frames are to be allocated to each
active process, and whether the set of pages to be considered for replacement should
be limited to those of the process that caused the page fault or encompass all the page
frames in main memory.
What need does memory management attempt to fulfill? - Solution 1. Relocation - A
process that has been swapped out to a disk can be relocated to a different memory
location than the one it was in previously.
2. Protection - protection of each process from unwanted interference caused by other
processes. That is, programs executing in other processes should not be able to
reference memory locations of process for reading/writing purposes without
permission, satisfied by the processor (hardware)
3. Sharing - Allowing a set of processes share the same area of main memory. Any
memory management system must allow controlled sharing of memory regions among
more than one process if so desired while not compromising protection
4. Logical organization - Most of the Logically dealing with user programs and data in
modular pieces- the OS and computer hardware have to be able to deal logically with
user programs and data as modules of some sort.
5. Physical organization- the form that information takes in the transfer of it between
main and secondary memory
Why is the ability to move processes around desirable? - Solution It is restrictive to say
that when a process is swapped back in, that it must be put back in the same memory
location it had previously.
Why doesn't the compiler prevent memory protection violations? Solution The OS
cannot know, beforehand, all the memory a program may refer to; even if it could, it
would be too time-consuming to check each program in advance for possible
memory-reference violations.
What are some reasons to allow two or more processes to all have access to a
particular region of memory? - Answer If a number of processes are executing the same
program it is advantageous to allow each process to access the same copy of the
program rather than to have its own copy. Processes that are cooperating on some task
may need to share access to the same data structure.
,What are the advantages of using unequal-size partitions in a fixed-partitioning scheme?
Solution Processes are assigned so as to minimize wasted memory within a partition
(internal fragmentation). Larger size programs can be accommodated without overlay.
What is the difference between internal and external fragmentation? - Answer Internal
fragmentation mean there is wasted space internal to a partition due to the fact that the
block of data loaded is smaller than the partition.
External fragmentation occurs when memory is allocated and a small piece is left over
that cannot be effectively used.
What are some of the differences between Logical, Relative, and Physical addresses? A
logical address is a name for the memory location independent of the actual assignment
of data to memory. A translation must be made to a physical address before the memory
access can be achieved.
A relative address is a special type of logical address, in which the address is specified
as a distance from some known point, called the origin, or base, which is usually a value
in a processor register. A physical address is an actual address in main memory.
What is the difference between a page and a frame? - Answer A page is a part of a
process while a frame is a part of memory.
What is the major distinction between a page and a segment? Solution Segmentation is
visible to the programmer and is offered as a convenience for organizing programs and
data whereas paging is invisible to the programmer.
What is the difference between simple paging, and virtual memory paging? - Solution
Whereas in simple paging, for a process to execute, all of its pages must be brought into
main memory. In virtual memory, pages are read in on demand. Also in virtual memory
paging, a read of a page into main memory could require a write of a page to disk.
Explain thrashing. - Answer Thrashing is when the system spends most of its time
swapping pieces of a process rather than executing instructions. To overcome this, the
OS essentially guesses which pieces are least likely to be used in the near future, based
on recent history, and will swap those out of main memory.
, Why is the principle of locality crucial to the use of virtual memory? -Solution The
principle of locality says that program and data references within a process tend to
cluster. The first fact above justifies the assumption, made in the preceding chapter,
that at any given time only small pieces of a process are in actual use. It also supports
the hope, expressed there, that intelligent guesses can be made about which pieces of a
process will be needed in the near future so as to avoid thrashing. These two things
combined mean that virtual memory is a concept that can be applied and is worth
implementing.
What might a page table entry consist of? Describe each field. - Solution The frame
number, indicates to the corresponding page in main memory.
A modify (M) bit, that indicates if the contents of the corresponding page have been
changed since the page was last loaded into main memory.
A present (P) bit, which says whether the corresponding page is in main memory or not.
What is the purpose of a translation lookaside buffer? - Answer To reduce the memory
access time of a virtual memory scheme. It acts as a cache for recently used page table
entries.
Briefly define the alternative page fetch policies. - Solution Demand paging - A page is
brought into main memory only when a reference is made to a location on that page.
Prepaging - Pages other than the one demanded by a page fault are brought in.
What is the difference between resident set management and page replacement policy?
- Answer Resident set management - how many page frames are to be allocated to each
active process, and whether the set of pages to be considered for replacement should
be limited to those of the process that caused the page fault or encompass all the page
frames in main memory.