os assignment
os assignment
LECTURER : MR Luyengo
Concept of Paging in an Operating System
**Example**:
- Virtual address space: 16 KB, Page size: 4 KB.
- Virtual address space divided into 4 pages (Page 0, Page 1, Page 2, Page 3).
- Physical memory has 4 frames (Frame 0, Frame 1, Frame 2, Frame 3).
Page Table:
```
Page | Frame
0 | 2
1 | 0
2 | 3
3 | 1
```
If the process accesses a virtual address in Page 1, the OS finds that Page 1 is mapped to Frame 0
and retrieves data from Frame 0.
#### Advantages:
- Eliminates external fragmentation.
- Efficient memory use by loading only needed pages.
- Simplifies memory allocation and deallocation.
#### Disadvantages:
- Overhead of maintaining the page table.
- Internal fragmentation if the process size isn’t a multiple of the page size.
A process is an instance of a program in execution. It goes through several states during its
lifecycle, representing its current activity.
#### Diagram:
```
+--------+ +--------+ +---------+
| New | -- | Ready | -- | Running |
+--------+ +--------+ +---------+
| |
| |
V v
+---------+ +-----------+
| Waiting | | Terminated |
+---------+ +-----------+
```
#### Example:
1. User starts a text editor (New → Ready).
2. Text editor is loaded into memory and waits for CPU time (Ready → Running).
3. Text editor waits for user input (Running → Waiting).
4. User types, and the editor resumes execution (Waiting → Ready → Running).
5. User closes the editor, and the process terminates (Running → Terminated).
#### Advantages:
- Efficient resource management by the OS.
- Clear structure for scheduling and execution.
#### Disadvantages:
- Overhead of managing state transitions.
- Potential for deadlocks if not managed properly. (QuillBot)
Works Cited
QuillBot, 2025. “QuillBot Flow.” (Mar 2025 Version) [Large Language Model], 2025, quillbot.com/flow.