Assignment 4 Takmeel Afzal
Assignment 4 Takmeel Afzal
Technology
Name: Takmeel Afzal
Simple Paging and Virtual Memory Paging are both memory management techniques, but they
are different in how they are implemented and their purpose.
Simple Paging:
In a simple paging, the whole process is divided into fixed-size blocks known
as pages and the physical memory is divided into fixed-size blocks known
as frames (Silberschatz, 2018)
The OS maintains a page table for every process which correlates logical addresses to
physical addresses (Stallings, 2020).
Simple paging does nothing with secondary storage (disk) For execution, a process must
have all of its pages in main memory (Arpaci-Dusseau, 2018).
The size is constrained by physical memory, i.e., the process has to fit in main memory.
Virtual memory paging improves simple paging as it enables processes to access more
memory than the physical one through secondary storage (e.g., disk) (Tanenbaum, 2015).
The resident set (a subset of pages) of a process is kept in main memory only. The
remaining pages are kept on disk (Silberschatz, 2018).
When a process accesses a page that is not currently in main memory, this results in a
page fault, and the operating system loads the required page into memory, evicting some
other page (depending on the page replacement policy) (Stallings, 2020)
Virtual memory paging allows multiprogramming, as more processes can fit in memory
than by straightforward paging (Arpaci-Dusseau, 2018).
Simple paging vs. Virtual paging: Simple paging needs a whole process in main memory. When
the process is tied to-disks, it can efficiently store tricky processes and benefit the system; hence
the virtual memory paging arrives.
Question 2:
Page:
A page involves a fixed-size block of data in the logical address space of a process
(Silberschatz, 2018)
Pages are used to divide a process into manageable chunks for memory management
(Silberschatz, 2018)
Page size is typically a power of 2 (e.g., 4 KB, 8 KB) (Tanenbaum, 2015)
Frame:
Frame is a fixed-size block of data in the physical memory (RAM) (Silberschatz, 2018).
Tracks are used to refer to pages that are also stored in secondary memory (Stallings,
2020)
The size of a frame is equal to the size of a page, so there is a one to one mapping
between pages and frames (Arpaci-Dusseau, 2018).
Question 3:
Difference: Resident Set Management is concerned with how many pages should be kept in
memory for each process and Page Replacement Policy is similarly concerned with which
page should be replaced when there is no more room for a new page.
Question 4:
The Buddy System divides memory into power-of-two-sized blocks. If a block is too large for a
request, it is split into smaller "buddies" until a suitable size is found.
Memory Allocation Steps:
Initial State: The system starts with 1024 KB (1 MB) of memory.
1. Process 1 Requests 65 KB:
The smallest block that can accommodate 65 KB is 128 KB (next power of 2).
1024 KB → split into 512 KB → 256 KB → 128 KB.
Process 1 is assigned 128 KB.
2. Process 2 Requests 135 KB:
The next smallest available block is 256 KB.
512 KB → split into 256 KB.
Process 2 is allocated 256 KB.
3. Process 3 Requests 215 KB:
The last 256 KB block is assigned to Process 3.
4. Process 1 Releases Memory:
The 128 KB block is freed and marked as available.
5. Process 4 Requests 45 KB:
The 128 KB block is split into two 64 KB blocks.
Process 4 is assigned 64 KB, and the remaining 64 KB is free.
6. Process 2 Finishes Execution:
The 256 KB block assigned to Process 2 is released.
7. Process 4 Finishes Execution:
The 64 KB block is merged back into 128 KB.
Final Memory State:
256 KB Free
128 KB Free
References
Bovet, D. P., & Cesati, M. (2005). Understanding the Linux Kernel (3rd ed.). O'Reilly Media.
Dusseau, R. H., & Arpaci-Dusseau, A. C. (2018). Operating Systems: Three Easy Pieces. Arpaci-
Dusseau Books.
Operating System Concepts. (n.d.). Buddy System Allocation. Retrieved from https://www.os-
book.com
Russinovich, M. E., Solomon, D. A., & Ionescu, A. (2012). Windows Internals (6th ed.).
Microsoft Press.
Silberschatz, A., Galvin, P. B., & Gagne, G. (2018). Operating System Concepts (10th ed.).
Wiley.
Stallings, W. (2020). Operating Systems: Internals and Design Principles (10th ed.). Pearson.
Tanenbaum, A. S., & Bos, H. (2015). Modern Operating Systems (4th ed.). Pearson.