Operating System
Operating System
a) Define process:
7. Rename a file
4. Security – Ensures unauthorized It supervises performance, handles
access is prevented. errors, and manages files and
devices.
The Operating System (OS) acts as an b) What is scheduling? Compare short term
interface between the user and hardware. scheduler with medium term scheduler.
Its roles include:
Scheduling is the process of selecting
Managing hardware and software processes from the queue and allocating
resources system resources (especially CPU) to them.
| Program Counter |
c) Draw and explain Process Control Block
(PCB): +-------------------------+
CopyEdit
+-------------------------+
Multiprogrammi Multiprocessi v |
Feature
ng ng
+-------------+ Event occurs
No true True | Running |------------------->+
Parallelis parallelism; CPU parallelism;
m switches processes can +-------------+
between tasks run in parallel |
Increases v
Increases CPU throughput
Efficiency +---------------+
utilization and
performance | Waiting |
More complex +---------------+
Complexit (hardware and
Less complex |
y OS support
needed) v
+-------------+
| |
Internal External Order of execution based on burst time:
Factor
Fragmentation Fragmentation P2 → P4 → P3 → P5 → P1
Wasted CopyEdit
Wasted memory | P2 | P4 | P3 | P5 | P1 |
memory inside outside
Definition 0 1 2 4 9 19
allocated allocated blocks
blocks. (between
them).
ii) Average Turnaround Time and Waiting
Due to fixed- Due to variable- Time
Cause size memory sized memory
allocation. allocation. Waitin
Burs Turnaroun
Proces Completio g Time
Allocating 100 Multiple small t d Time (CT
s n Time (TAT -
KB block for a free spaces Time - AT)
BT)
Example 90 KB process can't satisfy a
→ 10 KB is request of 100 P2 1 1 1 0
wasted. KB. P4 1 2 2 1
Use paging or Use compaction P3 2 4 4 2
Solution better block- or
fitting strategy. segmentation. P5 5 9 9 4
P1 10 19 19 9
Q4 Divides Divides
a) Explain Linked Allocation in Files memory into memory into
Division Basis
fixed-size variable-size
Linked Allocation is a method of file storage pages segments
on disk where each file is a linked list of
disk blocks, which may be scattered All pages are Segments
Size
anywhere on the disk. equal size vary in size
|125 - 84| = 41 ↓
|168 - 93| = 75 ↓
3 3 9, 2, 3 ✅ How It Works:
8 6 3, 4, 5, 6 ✅ (remove 2) Example:
Solutions:
Features:
Simple to implement.
Problems:
Types: