Answer Key -OS
Answer Key -OS
Structure All OS services run in kernel mode Only essential services in kernel mode
Stability Less stable (bug in one module may crash system) More stable (services run in user space)
3. When a process creates a new process using the fork() operation, which of the following state is
shared between the parent process and the child process?
Shared Memory Segment
By default, the child gets a copy of the parent’s memory. However, shared memory segments (if explicitly
created) are shared between both.
4. List the situations that may require the scheduler to make scheduling decisions.
When a process switches from running to waiting.
When a process terminates.
When a process is created.
When a process switches from waiting to ready.
5. List any two differences between a physical address and a logical address.
PART B 5 X 13 = 65 MARKS
11. a) (i) What are system calls? State and explain the types of system calls.[5 Marks]
Definition:
A system call is a programmatic way in which a user program requests a service from the operating
system's kernel. These services may include hardware-related services (I/O), file management, process
control, and more.
Types of System Calls:
1. Process Control:
o Create, terminate, load, execute processes.
o E.g., fork(), exit(), wait()
2. File Management:
o Create, open, read, write, close files.
o E.g., open(), read(), write(), close()
3. Device Management:
o Request/release device, read/write to device.
o E.g., ioctl(), read(), write()
4. Information Maintenance:
o Get/set system data, time, process attributes.
o E.g., getpid(), alarm()
5. Communication:
o Message passing between processes (IPC).
o E.g., pipe(), shmget(), msgsnd()
11. a) (ii) Explain the various structures of an operating system.[8 Marks]
1. Monolithic Architecture:
OS is a large, single executable.
All services (I/O, file management, memory) are in the kernel.
Example: MS-DOS
Pros: Fast performance
Cons: Hard to debug and maintain
2. Layered Architecture:
OS is divided into layers. Each layer performs specific functions and interacts only with the layer
below.
Example: THE operating system
Pros: Modularity, ease of debugging
Cons: Overhead due to multiple layers
3. Microkernel Architecture:
Only essential functions (e.g., memory management, IPC) run in kernel mode.
Other services (device drivers, file systems) run in user mode.
Example: QNX, Minix
Pros: Stability and security
Cons: May reduce performance due to increased user-kernel communication
4. Modular Architecture:
Kernel has loadable modules (like plug-ins) for extending features.
Example: Linux Kernel
Pros: Flexibility and easy customization
Cons: Slight performance overhead
5. Hybrid Architecture:
Combination of monolithic and microkernel designs.
Example: Windows NT, macOS
Pros: Performance + Modularity
Cons: Increased complexity
(OR)
11. b) A company is looking to upgrade its current computer system... recommend an architecture
that would enhance performance and scalability.[13 Marks]
Recommended Architecture:
1. CPU Architecture:
Use multi-core processors for parallel execution.
Choose 64-bit architecture for large address space.
Support for virtualization (e.g., Intel VT-x or AMD-V).
2. Memory:
Increase RAM capacity (e.g., 16 GB or more for multitasking).
Use DDR4/DDR5 for faster access.
Implement virtual memory and memory paging.
3. Storage:
Upgrade to NVMe SSDs for fast read/write.
Use RAID (Redundant Array of Independent Disks) for reliability and performance.
4. Input/Output Devices:
High-speed I/O buses (USB 3.0, Thunderbolt).
Network Interface Cards (NICs) for faster communication.
Use DMA (Direct Memory Access) to reduce CPU load during I/O.
5. Scalability Considerations:
Modular system components for future upgrades.
Support for cloud integration and virtual machines.
Use of server-grade motherboards for expandability.
12 a) CPU Scheduling Algorithms
Given processes:
P1 (Email) 0 10 4
P2 (Web Browsing) 1 5 3
P3 (Video Streaming) 3 2 1
P4 (Database Querying) 4 3 2
(OR)
13 b)
(i) Thrashing
Excessive paging (more time swapping than executing).
Occurs when memory is overcommitted.
Example: Multiple large processes with limited RAM.
(ii) Swapping
Moves processes in and out of RAM.
Used when memory is full.
Sketch: RAM → Disk → RAM.
(OR)
14 b) Disk Scheduling Algorithms
Given:
Cylinders: 0–99
Request sequence: 10, 22, 20, 2, 40, 6, 38
Current head position: 20
Seek time = 6 ms per cylinder
Algorithms:
1. FCFS:
o Order: 10 → 22 → 20 → 2 → 40 → 6 → 38
o Seek Sequence:
|20-10| + |10-22| + |22-20| + |20-2| + |2-40| + |40-6| + |6-38|
= 10 + 12 + 2 + 18 + 38 + 34 + 32 = 146 cylinders
o Total Seek Time = 146 × 6 = 876 ms
o Average Seek Time = 876 / 7 = 125.14 ms
2. SSTF (Shortest Seek Time First):
o Order (closest first from 20): 20 → 22 → 10 → 6 → 2 → 38 → 40
o Seek sequence: 0 + 2 + 12 + 4 + 4 + 36 + 2 = 60
o Total Seek Time = 60 × 6 = 360 ms
o Avg = 360 / 7 = 51.43 ms
3. LOOK:
o Head moves towards higher cylinders first then back.
o Sorted: 2, 6, 10, 20, 22, 38, 40
o Order: 20 → 22 → 38 → 40 → 10 → 6 → 2
Seek = |20-22| + |22-38| + |38-40| + |40-10| + |10-6| + |6-2| = 2 + 16 + 2 + 30 + 4 + 4 = 58
o Total Seek Time = 348 ms, Avg = 49.71 ms
4. SCAN (Elevator):
o Moves to end, then reverses.
o Order: 20 → 22 → 38 → 40 → 99 → 10 → 6 → 2
o Seek = |20-22| + |22-38| + |38-40| + |40-99| + |99-10| + |10-6| + |6-2| = 2 + 16 + 2 + 59 + 89
+ 4 + 4 = 176
o Total Seek Time = 1056 ms, Avg = 150.86 ms
5. C-SCAN:
o Moves to end, jumps to beginning, continues
o Order: 20 → 22 → 38 → 40 → 99 → 0 → 2 → 6 → 10
o Seek = 2 + 16 + 2 + 59 + 99 + 2 + 4 + 4 = 188
o Total Seek Time = 1128 ms, Avg = 161.14 ms
15 a) Mobile OS System Components
Components:
o Kernel: Core control of hardware resources.
o Device Drivers
o UI System
o Application Framework
o Middleware
iOS Features:
o Closed-source, tight hardware integration.
o Secure, optimized performance.
Android Features:
o Open-source, customizable.
o Broad device support.
(OR)
15 b) Virtualization and Hypervisors
i) Virtualization Concept
Abstracts hardware into multiple virtual environments.
Allows multiple OS instances on the same hardware.
Hypervisor handles CPU, memory, I/O for VMs.
ii) Type 1 vs Type 2 Hypervisors
P0 6012 4001
P1 1750 1000
P2 2356 1254
P3 1653 0633
P4 1656 0212
Process A B C D
P0 2 0 1 1
P1 0 7 5 0
P2 1 1 0 2
P3 1 0 2 0
P4 1 4 4 4
Page No Frame No
0 13
Page No Frame No
1 11
2 9
3 7
4 5
5 3
6 1
7 2
8 4
9 6
10 8
Prepared By Approved By
(M.Abernakumari,AP/AI&DS) (Dr.R.Murugadoss,AP/AI&DS)