In: Computer Science
Q1. If we decide to use two pairs of base-limit registers (one
for Instructions, one for
data), what will be its advantages and disadvantages.
Q2. Describe the mechanism where a segment could belong to the
address spaces of
two different processes.
Q3. Consider a logical address space of 64 pages of 1,024 bytes
each, mapped onto a
physical memory of 32 frames.
a. How many bits are there in the logical address?
b. How many bits are there in the physical address?
Q4. Most systems allow a program to allocate more memory to its
address space during
execution. Allocation of data in the heap segments of programs is
an example of such
allocated memory. What is required to support dynamic memory
allocation in the
following schemes?
a. Contiguous memory allocation
b. Segmentation
c. Paging
Q1. If we decide to use two pairs of base-limit
registers (one for Instructions, one for
data), what will be its advantages and
disadvantages.
Answer: The main advantage of this scheme is that -
(i)it is an effective mechanism for code and data sharing. For example, only one copy of an editor or a compiler needs to be kept in memory, and this code can be shared by all processes needing access to the editor or compiler code. (ii)Another advantage is protection of code against erroneous modification.
The only disadvantage is that -
the code and data must be separated, which is usually adhered to in a compiler-generated code.
Q2. Describe the mechanism where a segment could
belong to the address spaces of
two different processes.
Answer: Since segment tables are a collection of base–limit registers, segments can be shared when entries in the segment table of two different jobs point to the same physical location. The two segment tables must have identical base pointers, and the shared segment number must be the same in the two processes.
Q3. Consider a logical address space of 64 pages of
1,024 bytes each, mapped onto a
physical memory of 32 frames.
a. How many bits are there in the logical address?
b. How many bits are there in the physical
address?
Answer:
P | P | P | P | P | - | - | - | - | - | - | - | - | - | - |
Logical Address (P = page number bits)
P | P | P | - | - | - | - | - | - | - | - | - | - |
Q4. Most systems allow a program to allocate more
memory to its address space during
execution. Allocation of data in the heap segments of programs is
an example of such
allocated memory. What is required to support dynamic memory
allocation in the
following schemes?
a. Contiguous memory allocation
b. Segmentation
c. Paging
Answer: Dynamic memory allocation deals with managing memory at run time ,it can be handeled in the following schemes -
a.Contiguous memory allocation: Due to the absence of the enough space for the program to grow it allocated memory space then relocation of the entire program might be required.
b. Segmentation: Due to the absence of the enough space for the segment to extended its allocated memory space ,then the segment might required relocation .
c. Paging: In this scheme ,increasing the allocation of new pages is potential without requiring relocation of the program address space .