0% found this document useful (0 votes)
19 views20 pages

OSY Solved Question Bank

Uploaded by

Vedant
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)
19 views20 pages

OSY Solved Question Bank

Uploaded by

Vedant
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/ 20

UNIT-1

2 marks Questions
1. Two features of Linux:

 Open Source: Source code is freely available and modifiable.

 Multiuser Support: Multiple users can access the system simultaneously.

2. Differences between Time Sharing System and Real-Time System:

Aspect Time Sharing System Real-Time System

Provides time slices to multiple Ensures timely response to external


Purpose
users/programs. events.

Criticality Non-critical; delays are tolerable. Critical; delays can lead to system failure.

3. Real-Time Operating System (RTOS):

Definition: An OS designed to process tasks within a defined time constraint.


Applications:

 Industrial automation systems.

 Embedded systems in medical devices.

4. Two advantages of Multiprocessor Systems:

 Increased Throughput: Tasks are processed faster by multiple CPUs.

 Fault Tolerance: Failure of one processor doesn't halt the entire system.

4 marks Questions

1. Enlist types of operating systems and explain multiprogramming OS in detail.

Types of Operating Systems:

1. Batch OS

2. Time Sharing OS

3. Distributed OS

4. Real-Time OS

5. Multiprogramming OS
6. Multiprocessor OS

Multiprogramming OS Explanation:

 Definition: Multiprogramming OS allows multiple programs to reside in the main memory


simultaneously and execute by sharing the CPU.

 Working:

o When one program is waiting for I/O operations, the CPU switches to another
program.

o This improves CPU utilization and reduces idle time.

 Advantages:

o Efficient resource utilization.

o Increased throughput.

 Example: UNIX.

2. Describe working of a time-sharing system with a neat diagram.

Working:

 Time-sharing OS allows multiple users to share CPU time concurrently by dividing time into
small slices, known as time quanta.

 Each user's program gets a time quantum for execution. If the program doesn't complete, it
moves to the back of the queue.

 The switching process is fast enough to create an illusion of simultaneous execution.


Advantages:

 Better interaction for multiple users.

 Reduces idle CPU time.

Diagram:
(Show multiple terminals connected to a central CPU, with arrows indicating time-sharing among
them).

3. Enlist OS tools and explain any two in detail.

Enlist:

1. Task Manager

2. Disk Cleanup

3. File Explorer

4. Performance Monitor
Explanation:

 Task Manager:

o Displays running processes, memory usage, and CPU load.

o Allows users to end tasks or monitor system performance.

 Disk Cleanup:

o Identifies and removes unnecessary files like temporary data, recycle bin content,
etc.

o Helps in optimizing disk space and performance.

4. Differentiate between CLI-based OS and GUI-based OS (any 4 points).

Aspect CLI-Based OS GUI-Based OS

Interface Text-based command line. Graphical interface with icons.

Ease of Use Requires knowledge of commands. User-friendly and intuitive.

Resources Consumes fewer system resources. Requires more memory and CPU.

Speed Faster for experienced users. Slower compared to CLI.

5. Describe multiprocessor OS with its advantages (any two).

Explanation:

 A multiprocessor OS is designed to handle and coordinate multiple CPUs working together.

 CPUs share memory, resources, and tasks to improve performance.

Advantages:

1. Increased Throughput: Multiple CPUs allow parallel processing, reducing task completion
time.

2. Fault Tolerance: Failure of one processor doesn’t stop the entire system.

6. Explain real-time OS and its types.

Explanation:

 A real-time OS is designed to handle tasks within a fixed time constraint, ensuring immediate
and predictable responses.

Types:

1. Hard Real-Time OS:

o Guarantees strict deadlines with no delays tolerated.


o Used in critical systems like pacemakers, airbag systems.

2. Soft Real-Time OS:

o Allows slight deviations from deadlines.

o Used in multimedia systems, video streaming.

Unit 2

2 marks questions

1. Four services provided by OS

 Process Management: Manages process creation, execution, and termination.

 Memory Management: Allocates and deallocates memory for programs.

 File Management: Provides mechanisms to create, delete, and access files.

 Security: Ensures user data protection through authentication and permissions.

2. Four types of system calls

 Process Control: For process creation and termination (e.g., fork, exit).

 File Management: For file operations like read, write, open, and close.

 Device Management: For device control, such as request and release of devices.

 Communication: For data exchange between processes (e.g., send, receive).

4 marks Questions

1. List components of OS and explain process management in detail.


Components of OS:
1. Process Management
2. Memory Management
3. File Management
4. Device Management
5. Security
6. User Interface
Process Management:
 Responsibilities:
o Scheduling processes (short-term, long-term, and medium-term).
o Creating, executing, and terminating processes.
o Managing process synchronization and communication.
o Handling deadlocks among processes.

2. Purpose of system calls and types with examples


Purpose: Provides an interface between user applications and the operating system to
request OS services.
Types of System Calls with Examples:
1. Process Control: Create or terminate a process (e.g., fork, exit).
2. File Management: Open, read, write, and close files (e.g., open, read).
3. Device Management: Request or release devices (e.g., ioctl, read).
4. Communication: Send and receive messages (e.g., send, recv).

3. Enlist OS tools and explain any two in detail.


Tools:
1. Task Manager
2. Performance Monitor
3. Disk Cleanup
4. Device Manager
Explanation:
 Performance Monitor: Tracks system performance metrics like CPU, memory
usage, and network activity.
 Device Manager: Allows users to view and manage hardware devices, including
updating drivers and troubleshooting issues.
4. List and describe any four services of the operating system.
1. Process Management: Schedules and manages processes in the system.
2. Memory Management: Allocates and deallocates memory for programs.
3. File System Management: Provides file storage, access, and permissions.
4. I/O Management: Handles input and output devices efficiently.

5. Activities of OS components
i) Main Memory Management:
 Keeps track of used and free memory.
 Allocates and deallocates memory to processes.
 Ensures proper memory protection and access.
ii) File Management:
 Provides file creation, deletion, and access mechanisms.
 Maintains directories and file structures.
 Ensures security and permissions for file access.

6. Uses of OS Tools
i) Security Policy:
 Implements rules for system and data access.
 Protects against unauthorized activities and ensures system integrity.
ii) User Management:
 Manages user accounts, permissions, and authentication.
 Tracks user activity and allocates system resources.
iii) Task Scheduler:
 Allocates CPU time to processes based on priority.
 Manages multitasking and ensures smooth operation.
Alternate Use Cases:
i) Device Management:
 Manages hardware devices and drivers.
 Resolves conflicts and ensures proper functionality.
ii) Performance Monitor:
 Analyzes and optimizes system performance.
 Identifies resource bottlenecks.

Unit 3 :- Process Management


2 Marks Questions
1. Draw Process State Diagram
(Include states: New, Ready, Running, Waiting, Terminated, and transitions
between them).

2. Syntax of Commands
o sleep: sleep [number of seconds]
o kill: kill [signal] PID

3. Commands to Perform Tasks


o Add delay in script: sleep [seconds]
o Terminate a process: kill PID

4. Use of ps Command and Long Forms


o Use: Displays information about running processes.
o Long Forms:
 UID: User Identifier
 PID: Process Identifier

4 Marks Questions
1. Inter-Process Communication (IPC) Model
o Shared Memory Method:
 Processes share a region of memory to exchange data.
 One process writes data, and another reads it.
 Diagram: Show two processes accessing a shared memory segment.
2. ps Command with Four Options
o ps -a: Lists all processes.
o ps -u: Shows processes by a specific user.
o ps -x: Displays processes without a terminal.
o ps -e: Displays all system processes.

3. Unix Commands
o Create folder OSY: mkdir OSY
o Create file FIRST in OSY: touch OSY/FIRST
o List files and directories: ls -l
o Clear screen: clear

4. Types of Scheduler
o Long-Term Scheduler: Selects processes to be loaded into memory.
o Short-Term Scheduler: Assigns CPU to ready processes.
o Medium-Term Scheduler: Suspends/resumes processes for better resource
management.

5. Process Control Block (PCB)


o Stores information about a process:
 Process ID, State, Program Counter, Registers, Memory Limits.
o Diagram: Show PCB linked to process scheduling.

6. Shared Memory vs. Message Passing IPC

Aspect Shared Memory Message Passing

Data Exchange Through shared memory region. Through messages.

Speed Faster for large data. Slower due to message overhead.

Complexity Requires synchronization. Simpler to implement.


7. Use of ps and wait Commands
o ps: Displays process details (e.g., ps -aux).
o wait: Waits for a process to complete (e.g., wait PID).

8. Scheduling Queues in Process Scheduling


o Types: Ready Queue, Waiting Queue, Job Queue.
o Use: Organizes processes at various stages of execution.
o Diagram: Show processes moving between queues.

9. Types of Schedulers
o Same as Q4 above.

10. Commands with Syntax


o kill: Terminates a process (kill -9 PID).
o sleep: Adds delay (sleep [seconds]).
o wait: Waits for a process to finish (wait PID).
o exit: Terminates a shell or script (exit [code]).

11. CPU Switch from Process to Process


o Involves saving the state of the current process and loading the state of the
next process.
o Diagram: Show PCB saving/loading during context switch.

6 Marks Questions
1. One-to-One Multi-Threading Model
o Each thread maps to a kernel thread.
o Diagram: Show one user thread linked to one kernel thread.
o Advantages:
1. Parallelism at kernel level.
2. Threads do not block each other.
2. Process vs. Thread

Aspect Process Thread

Definition Independent program execution. Lightweight process.

Resources Requires separate resources. Shares resources with process.

Benefits of Multi-Threaded Programming


 Faster context switching.
 Efficient use of CPU for parallelism.

Unit 4 :- CPU Scheduling and Algorithm

2 Marks Questions
1. Four Scheduling Criteria
o CPU Utilization: Maximize CPU usage.
o Throughput: Number of processes completed per unit time.
o Turnaround Time: Total time from submission to completion.
o Waiting Time: Time a process spends in the ready queue.

2. Difference between Preemptive and Non-Preemptive Scheduling

Aspect Preemptive Scheduling Non-Preemptive Scheduling

Interruption Allows process interruption. Process runs till completion.

Response Time Better for short tasks. May cause longer delays.

3. Definition of Deadlock
 Deadlock is a state where multiple processes are unable to proceed because each
is waiting for resources held by another process.

4. Use of ps Command
 Use: Displays information about running processes.
 UID: User Identifier.
 PID: Process Identifier.

5. Syntax of Commands
 sleep: sleep [seconds]
 kill: kill [signal] PID

4 Marks Questions
1. I/O Burst and CPU Burst Cycle
o CPU Burst: Time spent by a process executing on the CPU.
o I/O Burst: Time spent waiting for I/O operations.
o Diagram: Alternate cycles of CPU burst and I/O burst.

2. Deadlock and Necessary Conditions


o Definition: See Q3 above.
o Necessary Conditions:
1. Mutual Exclusion.
2. Hold and Wait.
3. No Preemption.
4. Circular Wait.

3. Round Robin Algorithm with Example


o Description:
 Each process gets a fixed time slice (quantum).
 Processes are scheduled cyclically.
o Example:
Process: P1, P2, P3; Burst Times: 6, 4, 8; Quantum: 2.
 Gantt Chart: Show time slices for each process.
 Calculate waiting and turnaround times.
4. Two Scheduling Criteria
o CPU Utilization: Maximize CPU use.
o Waiting Time: Minimize waiting time in the queue.

5. Deadlock Prevention for Hold and Wait


o Allocate all resources to a process before it starts or ensure a process
releases its current resources before requesting new ones.

6. Steps for Banker's Algorithm


1. Calculate the need matrix (Need = Max - Allocation).
2. Check if resources are sufficient to satisfy a process's needs.
3. If yes, allocate and update resources; else, wait.
4. Repeat until all processes are finished or deadlock occurs.

7. Types of Schedulers
o Long-Term Scheduler: Selects processes for execution.
o Short-Term Scheduler: Assigns CPU to processes in the ready queue.
o Medium-Term Scheduler: Suspends and resumes processes.

8. Four Conditions for Deadlock


o Mutual Exclusion: Only one process can use a resource at a time.
o Hold and Wait: Processes hold resources while waiting for others.
o No Preemption: Resources can't be forcibly removed.
o Circular Wait: A circular chain of processes exists, each waiting for
resources held by another.

9. Scheduling Terms
o CPU Utilization: Percentage of time the CPU is busy.
o Throughput: Processes completed per unit time.
o Turnaround Time: Completion time minus arrival time.
o Waiting Time: Time spent in the ready queue.

10. Deadlock and Prevention


 Definition: See Q3 above.
 Prevention (Mutual Exclusion): Avoid assigning exclusive access to all resources.

11. FCFS Scheduling Example

Process Arrival Time Burst Time Completion Time Turnaround Time Waiting Time

P0 0 10 10 10 0

P1 1 29 39 38 9

P2 2 3 42 40 37

P3 3 7 49 46 39

P4 4 12 61 57 45

 Gantt Chart: P0 -> P1 -> P2 -> P3 -> P4.


 Average Waiting Time: (0 + 9 + 37 + 39 + 45) / 5 = 26 ms.
 Average Turnaround Time: (10 + 38 + 40 + 46 + 57) / 5 = 38.2 ms.

6 Marks Questions
1. SJF and FCFS Scheduling Example

Waiting Waiting
Arrival Burst Completion Completion Turnaround Turnaround
Process Time Time
Time Time Time (SJF) Time (FCFS) Time (SJF) Time (FCFS)
(SJF) (FCFS)

P1 0 7 7 7 7 7 0 0

P2 1 4 11 11 10 10 6 6

P3 2 10 21 21 19 19 9 9

P4 3 6 27 27 24 24 18 18

P5 4 8 35 35 31 31 23 23

 Gantt Chart (SJF): P1 -> P2 -> P4 -> P3 -> P5.


 Gantt Chart (FCFS): P1 -> P2 -> P3 -> P4 -> P5.
 Average Waiting Time: SJF = 11.2 ms, FCFS = 11.2 ms.
 Average Turnaround Time: SJF = 18.2 ms, FCFS = 18.2 ms.

UNIT 5 :- Memory Management

2 Marks Questions
1. Virtual Memory:
o Virtual memory is a memory management technique that provides an
illusion of a large memory by using physical memory and disk storage.
2. Paging and Segmentation:
o Paging: Divides memory into fixed-size blocks called pages to manage
memory efficiently.
o Segmentation: Divides memory into variable-sized segments based on
logical divisions of a program.
3. Definitions:
o Virtual Memory: See Q1 above.
o Paging: See Q2 above.
4. Fragmentation:
o Fragmentation is the unusable memory space that arises due to inefficient
memory allocation, either internally or externally.
5. Virtual Memory:
o See Q1 above.

4 Marks Questions
1. Partitioning and its Types
o Partitioning: Memory is divided into sections to allocate to processes.
 Fixed Partitioning: Memory is divided into fixed sizes.
 Variable Partitioning: Memory partitions vary dynamically as per
process needs.
2. LRU Page Replacement Algorithm
o Reference String: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1.
o Steps: Simulate page replacement with a given frame size.
o Calculate Page Faults: Number of times a new page replaces an existing
one.

3. Variable Partitioning of Memory


o Concept: Memory is allocated in varying sizes to fit processes, minimizing
internal fragmentation.
o Diagram: Illustrate dynamic allocation and deallocation of memory blocks.

4. Fragmentation
o Definition: Memory space waste due to inefficient allocation.
o Internal Fragmentation: Unused memory within allocated blocks.
o External Fragmentation: Unusable scattered free memory between
allocations.

5. Difference Between Paging and Segmentation

Aspect Paging Segmentation

Division Fixed-size blocks (pages). Logical units (segments).

Size Equal size pages. Variable size segments.

Mapping Physical address using page table. Physical address using segment table.

Purpose Simplifies memory management. Provides logical program division.

6. Fixed and Variable Memory Management


o Fixed: Predefined partitions; simple but causes internal fragmentation.
o Variable: Dynamic partitions adjust to process sizes; reduces internal
fragmentation but may cause external fragmentation.

7. Hole Allocation for Segment (8 KB)


o First Fit: Allocate to the first available hole (9 KB).
o Best Fit: Allocate to the smallest suitable hole (8 KB).
o Worst Fit: Allocate to the largest available hole (20 KB).

8. Fixed and Variable Memory Management


o See Q6 above.

6 Marks Questions
1. Virtual Memory and Paging
o Concept: Virtual memory uses paging to divide programs into fixed-size
pages and map them to physical frames in memory.
o Diagram: Draw paging hardware with page table, memory, and CPU.
o Example: Show mapping of logical addresses to physical addresses using the
page table.

2. Page Faults (Optimal and FIFO Algorithms)


o Reference String: 5, 6, 7, 8, 9, 7, 8, 5, 9, 7, 8, 7, 9, 6, 5, 6
o Frame Size: 3
o Steps: Simulate both algorithms:
 FIFO: Replace the oldest page first.
 Optimal: Replace the page not needed for the longest time in the
future.
o Output: Calculate and compare page faults.

3. Page Faults (Optimal, LRU, and FIFO Algorithms)


o Reference String: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
o Frame Size: 3
o Steps:
 Optimal: Predict future usage to replace pages.
 LRU: Replace least recently used page.
 FIFO: Replace oldest page first.
o Output: Calculate page faults for each algorithm.

4. Page Faults (LRU and Optimal Algorithms)


o Reference String: Same as Q3.
o Frame Size: 3
o Steps: Simulate LRU and Optimal algorithms step-by-step.
o Output: Calculate total page faults for each.

5. Free Space Management Techniques


o Techniques:
 Bitmap
 Linked List
 Grouping
 Counting
 Free Space Table
o Explanation (Bitmap):
 Represent free/used blocks with a bit array.
 1 indicates occupied; 0 indicates free space.
 Diagram: Show memory blocks with corresponding bitmap.
 Advantages: Efficient for small block sizes.

Unit 6 :- File Management

2 Marks Questions
1. Four File Attributes:
o Name: The name of the file, used to identify it.
o Type: The file’s format (e.g., text, binary).
o Size: The total number of bytes the file occupies.
o Location: The location or address of the file on the storage device.

2. Four File Operations:


o Create: To create a new file.
o Read: To read the contents of a file.
o Write: To write or modify the contents of a file.
o Delete: To remove the file from the system.

3. Four File Attributes and Their Meaning:


o Name: Identifies the file.
o Type: Specifies the kind of file (e.g., .txt, .exe).
o Size: The file’s data size in bytes.
o Access Time: The time when the file was last accessed.

4. Four File Attributes and Their Meaning:


o Name: The file’s identifier.
o Type: The file format or extension.
o Location: The address of the file in the storage.
o Permissions: The access rights associated with the file (e.g., read, write).

4 Marks Questions
1. Sequential and Direct Access Methods:
o Sequential Access: Data is accessed in a linear, one-by-one fashion, starting
from the beginning (e.g., tape storage).
o Direct Access: Data can be accessed in any order without reading the
preceding data, as done in hard drives.

2. Linked File Allocation Method:


o Diagram: A file is represented by a chain of blocks, with each block pointing
to the next block.
o Explanation:
 Each block contains a pointer to the next block.
 The last block contains a null pointer indicating the end of the file.
 It allows non-contiguous allocation, thus preventing fragmentation.

3. Two-Level Directory Structure:


o Diagram: The root directory contains pointers to subdirectories, and each
subdirectory contains files.
o Explanation:
 The root directory contains references to user directories.
 Each user directory contains the files, which helps in organizing files
by users or categories.

6 Marks Questions
1. File Allocation Methods and Contiguous Allocation:
o Methods:
 Contiguous Allocation
 Linked Allocation
 Indexed Allocation
o Contiguous Allocation:
 Explanation: Files are stored in consecutive blocks in memory. This
method is efficient in terms of access speed but suffers from
fragmentation.
 Advantages: Simple and fast to access.
 Disadvantages: Leads to fragmentation and inefficient utilization of
space.

2. Directory Structure in File System:


o Single-Level Structure: All files are stored in a single directory.
o Two-Level Structure: The root directory contains pointers to user
directories, and each user directory contains files.
o Tree Structure: A hierarchical directory structure where the root directory
contains subdirectories, which in turn contain files or subdirectories.
o Explanation: Each level introduces more flexibility and organization.

3. Directory Structures:
o Single-Level: All files are stored in one directory without subdirectories.
Simple but hard to manage.
o Two-Level: A root directory points to user directories, and each user
directory holds the files.
o Tree-Structured: Directories and subdirectories are organized hierarchically,
providing a flexible file management system.

4. File Allocation Methods and Explanation:


o Methods:
 Contiguous Allocation: Stores files in consecutive blocks.
 Linked Allocation: Uses pointers to link blocks of a file.
 Indexed Allocation: Uses an index block to store pointers to file
blocks.
o Explanation (Contiguous): Files are allocated contiguous blocks of memory,
ensuring fast access but leading to fragmentation issues.

You might also like