0% found this document useful (0 votes)
21 views6 pages

Assignment 4 Takmeel Afzal

The document discusses memory management techniques in operating systems, comparing simple paging and virtual memory paging. Simple paging requires all process pages to be in main memory, while virtual memory paging allows processes to access more memory using secondary storage. It also covers concepts like resident set management, page replacement policies, and the buddy system for memory allocation.

Uploaded by

Asad Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views6 pages

Assignment 4 Takmeel Afzal

The document discusses memory management techniques in operating systems, comparing simple paging and virtual memory paging. Simple paging requires all process pages to be in main memory, while virtual memory paging allows processes to access more memory using secondary storage. It also covers concepts like resident set management, page replacement policies, and the buddy system for memory allocation.

Uploaded by

Asad Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

University of Science and

Technology
Name: Takmeel Afzal

Subject: Operating Systems


Professor: Dr. Zineb Korachi
02/06/2025
Question 1:

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:

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

Difference: A page is a logical division of a process, whereas a frame is a physical division of


main memory. Logical address space contains pages, and physical memory contains frames.

Question 3:

 Resident Set Management:


 Resident Set Management is the process of how likely the operating system keeps how
much pages of a process in the primary memory (the resident set) (Silberschatz, 2018).
 This concerns the decision to allocate memory to processes, which will use either a fixed
allocation (every process has a fixed amount of frames) or a variable allocation (the
number of frames can dynamically change) (Stallings, 2020).
 Aim to trade off the number of processes in memory for a smaller number of page faults
(Arpaci-Dusseau, 2018).
 Page Replacement Policy:
 Page Replacement Policy decides which page to replace in main memory when new page
has to be fetched into main memory and there are no empty frames available in the
memory (Silberschatz, 2018).
 Common algorithms consist of Least Recently Used (LRU), First-In-First-Out (FIFO),
and Clock Policy (Stallings, 2020).
 The idea is to swap out the page that has low relevance for being used in the near future
to minimize page faults (Tanenbaum, 2015).

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:

Memory Block Status

256 KB Free

256 KB Process 3 (P3)

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.

Love, R. (2010). Linux Kernel Development (3rd ed.). Addison-Wesley.

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.

You might also like