Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
St. name: Ahmed Hassan St. Code: 2227066 Group: 4 Serial #: 26
Q(1): Check in Black only one of the choices following each statement.
1. Processes’ relocation means:
Օ 1- assigning various modules to the same region of memory Օ 4- all of the previous
Օ 2- assigning a memory region to a process Օ 5- none of the previous
Օ 3- assigning a page to the real memory
2. assigning various modules to the same region of memory is known as:
Օ 1- Segmentation Օ 4- all of the previous
Օ 2- Dynamic Partitioning Օ 5- none of the previous
Օ 3- Swapping
3. Overlaying means:
Օ 1- various modules of a program can be assigned different region of memory Օ 4- all of the previous
Օ 2- various modules of different programs can be assigned the same region of Օ 5- none of the previous
memory
Օ 3- Various modules of a program can be assigned the same region of memory.
4. Overlaying means
Օ 1- assigning various modules to the same region of memory Օ 3- assigning a page to the real memory
Օ 2- assigning a memory region to a process Օ 4- none of the previous
5. The Next fit algorithm often allocate a block of memory at the ………
Օ 1- Beginning of the memory Օ 2- end of memory Օ 3- largest block found Օ 4- none of the previous
6. Advantages of Breaking up a Process
Օ 1- More processes may be maintained in main memory Օ 3- A process may be larger than all of main
memory
Օ 2- it is very likely a process will be in the Ready state Օ 4- all of the previous
at any particular time
7. In which of the following placement Algorithms memory compaction must be done more often:
Օ 1- Next-fit Օ 2- Best-fit algorithm Օ 3- First-fit algorithm Օ 4- none of the previous
8. Overlaying means:
Օ 1- various modules of a program can be assigned different region of Օ 4- all of the previous
memory
Օ 2- various modules of different programs can be assigned the same region Օ 5- none of the previous
of memory
Օ 3- various modules of different programs can be assigned different region Օ
of memory.
9. which of the following placement algorithms is the worst one: worest in performance or what ???
Օ 1- Next-fit Օ 4- all of the previous
Օ 2- First-fit algorithm Օ 5- none of the previous
Օ 3- Best-fit algorithm Օ
10. Internal Fragmentation occurs in
Օ 1- Dynamic Partitioning Օ 4- Fixed Partitioning
Օ 2- Segmentation Օ 5- 3 and 4
Օ 3- Paging Օ 6- none of the previous
11. The Physical addresses
Օ 1- a location relative to some known point Օ 4- 1 and 3.
Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
Օ 2- the actual location in main memory Օ 5- all of the previous
o3- a location in the virtual memory o6- none of the previous
12. In which of the following placement algorithms the smallest amount of fragmentation is left:
Օ 1- Next-fit Օ 4- all of the previous
Օ 2- First-fit algorithm Օ 5- none of the previous
Օ 3- Best-fit algorithm Օ
13. External Fragmentation occurs in
Օ 1- Dynamic Partitioning Օ 4- Fixed Partitioning
Օ 2- Segmentation Օ 5- 1 and 2
Օ 3- Paging Օ 6- none of the previous
Q(2): Put in front of the right statements and × in front of the wrong statements and correct them.
1. The allocation of MM is controlled by the OS.
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
2. The memory references generated by a process must be checked at compile time to assure protection.
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
run
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
3. The OS maintains a single free-frame list of all frames in main memory that are currently unoccupied and
available for pages.
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
............................................................................................................................................ ................................................................................................................................... .............................................................................................................................
4. with segmentation a program may occupy more than one partition, and these partitions need to be
contiguous.
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
need not to be
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
5. One of the disadvantages for paging is the number of page frames specified at system generation time limits
the number of active processes in the system.
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
6. satisfying the relocation requirement increases the difficulty of satisfying the sharing requirement.
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
Protection ................................................................................................................................................................................................................................................................ .............................................................................................................................
....................................
7. Satisfying the relocation requirement increases the difficulty of satisfying the protection requirement.
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
Q(3): Answer the following questions
1] Mention the differences between dynamic partitioning and segmentation.
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
dynamic paritioning:
.................................... is to partioning the memory to partitions with......
............................................................................................................................. sizes same as the processes size with no internal fragmentation
............................................................................................................................. .............................................................................................................................
disadvantage .............................................................................................................................
.................................... high external fragmentation due to swap the processes ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
segmentation:.............................................................................................................................
.................................... is to divide the process into segments which loaded into dyamic partitions in memory in which each process
................................................................................................................................... is fully loaded when all its segmentation is loaded
.............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
to the memory
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
disadvantage:.............................................................................................................................
.................................... little external fragmantation ................................................................................................................................... .............................................................................................................................
Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
2] Mention the differences between fixed partitioning and paging:
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
fixed partitioning is to divide the memory into fixed sizes can be same or diffrent. Each process loaded into partition same or greater in size
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
disadvangage:.............................................................................................................................
.................................... high internal fragmentation ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
paging: memory divided into frames and processes is divided into pages in which each page is loaded in a frame .
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
disadvangage:
.................................... small amount internal fragmention
............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
3] In a Paging system, consider the following 16 bit logical address which consists of 10 bit for the offset
field and 6 bit for the page number field.
Suppose that the following is the page table for the process where this address occurs:
Find the physical address corresponding to the given logical address.
000110 0111011110
Ans.: ................................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
.................................... ............................................................................................................................. ................................................................................................................................... .............................................................................................................................
4] A dynamic partitioning scheme is being used, and the following is the memory configuration at a given
point in time:
The shaded areas are allocated blocks; the white areas are free blocks. The next three memory requests are
for A- 40M, B- 20M, and C- 10M. Indicate the starting address for each of the three blocks using the
following placement algorithms:
a. First-fit
b. Best-fit
c. Next-fit. Assume the most recently added block is at the beginning of memory.
Ans.:
a. First-fit
Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
b. Best-fit
c. Next-fit.
5] The black areas are allocated blocks; the white areas are free blocks. The next three memory requests
are for A- 40M, B- 20M, and C- 10M. Indicate the starting address for each of the three blocks using the
following placement algorithms:
1. a. First-fit
2. b. Best-fit
3. c. Next-fit.
Ans.:
1. a. First-fit
25 55 35 25 15 20 45 50 15 20
2. b. Best-fit
25 55 35 25 15 20 45 50 15 20
3. c. Next-fit.
25 55 35 25 15 20 45 50 15 20
5] Consider a system with a 16KB memory. The sequence of processes loaded in and leaving the memory are
given in the following. (12 Marks)
Process ID Process size Action # action
P1 7KB 1 Loaded
P2 4KB 2 Loaded
Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
P1 7 KB 3 terminated and returned the memory space
P3 3 KB 4 Loaded
P4 6 KB 5 Loaded
Assume that when a process is loaded to a selected "hole", it always starts from the beginning of the memory. For
the following placement algorithms: a) Give the memory map showing allocated portion and free portion after the
end of the sequence, b) If a process cannot be loaded, indicate that, and c) Indicate the internal/external
fragmentations.
1. first fit
2. best fit
3. paging (assume that each page is of size 2K)
Ans.
1. First fit (use the following figure for solving a and c)
16 KB
empty After action1 After action2 After action3 After action4 After action5
b. ........................................................................................
2. Best fit (use the following figure for solving a and c)
16 KB
Cairo University Computer Sciences Division
Faculty of science Sheet 5 Chapter 5
Mathematics Department Operating System 2025
Dr. Hatem Moharram
empty After action1 After action2 After action3 After action4 After action5
b. ........................................................................................
3. paging (use the following figure for solving a and c)
16 KB
empty After action1 After action2 After action3 After action4 After action5
b. ........................................................................................