0% found this document useful (0 votes)
12 views26 pages

Unit 5

The document provides detailed notes on operating systems, covering key concepts such as definitions, functions, types, process management, memory management, deadlock, file systems, I/O management, and security. It includes frequently asked questions, examples of scheduling algorithms, and various access methods. Additionally, it features practice multiple-choice questions to reinforce understanding of the material.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views26 pages

Unit 5

The document provides detailed notes on operating systems, covering key concepts such as definitions, functions, types, process management, memory management, deadlock, file systems, I/O management, and security. It includes frequently asked questions, examples of scheduling algorithms, and various access methods. Additionally, it features practice multiple-choice questions to reinforce understanding of the material.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

🖥️ Unit: Operating System – Detailed Notes (Bihar STET Paper 2 – Computer Science)

🔶 1. Basics of Operating Systems

🟩 Frequently Asked Topics:

 Definition and functions

 Types of OS

 Examples of OS (Windows, Linux, Unix)

📘 Key Points:

 Operating System: Software that manages hardware and software resources and
provides services to users and programs.

 Main Functions:

o Process Management

o Memory Management

o File System Management

o I/O Device Management

o Security and Protection

📝 Examples of Questions:

 “What is the main function of an Operating System?”

 “Which OS is open-source: Windows/Linux?”

🔶 2. Types of Operating Systems

🟩 Frequently Asked Topics:

 Batch OS

 Multiprogramming OS

 Time-sharing OS
 Real-Time OS

 Distributed OS

📘 Key Points:

OS Type Description Example

Jobs grouped together without user


Batch OS Early IBM systems
interaction

Time-Sharing
Each task gets CPU for a small time slice Unix, Linux
OS

RTOS in embedded
Real-Time OS Responds to inputs immediately
systems

Distributed OS Multiple systems act as a single system Amoeba, LOCUS

📝 Example Questions:

 “Which OS type is used in air traffic control systems?”

 “Name one distributed operating system.”

🔶 3. Process Management

🟩 Frequently Asked Topics:

 Process States

 Process Control Block (PCB)

 Context Switching

 Scheduling Algorithms

📘 Key Points:

 Process: A program in execution.

 States: New → Ready → Running → Waiting → Terminated

 PCB: Contains process ID, state, registers, etc.


 Context Switching: Saving state of one process and loading another.

🔷 CPU Scheduling Algorithms

Algorithm Description Features

FCFS First Come First Serve Non-preemptive, simple

SJF Shortest Job First Optimal, but can cause starvation

Round Robin Time slice for each process Preemptive, good for time-sharing

Priority Based on process priority Can lead to starvation

📝 Formulas:

 Turnaround Time = Completion Time – Arrival Time

 Waiting Time = Turnaround Time – Burst Time

📝 Example Questions:

 “Which algorithm is best for time-sharing systems?”

 “Define context switching.”

🔶 4. Memory Management

🟩 Frequently Asked Topics:

 Contiguous vs Non-contiguous allocation

 Paging and Segmentation

 Virtual Memory and Demand Paging

 Page Replacement Algorithms

📘 Key Concepts:

 Paging: Divides memory into fixed-size pages and frames.

 Segmentation: Divides memory into variable-sized segments (logical).


 Virtual Memory: Uses disk as an extension of RAM.

 Thrashing: Excessive page swapping, reducing performance.

🔷 Page Replacement Algorithms

Algorithm Strategy

FIFO Replace oldest page

LRU Replace least recently used page

Optimal Replace page not used for longest future

📝 Example Questions:

 “What is the difference between paging and segmentation?”

 “Which algorithm replaces the least recently used page?”

🔶 5. Deadlock

🟩 Frequently Asked Topics:

 Conditions for Deadlock

 Deadlock Prevention, Avoidance, and Detection

📘 Key Concepts:

 Deadlock: Circular waiting of processes for resources.

 Necessary Conditions:

1. Mutual Exclusion

2. Hold and Wait

3. No Preemption

4. Circular Wait

 Prevention: Break one of the conditions.


 Avoidance: Use Banker's Algorithm.

 Detection: Use resource allocation graphs.

📝 Example Questions:

 “List the necessary conditions for deadlock.”

 “Which algorithm is used for deadlock avoidance?”

🔶 6. File Systems

🟩 Frequently Asked Topics:

 File organization

 Directory structure

 File access methods

📘 Key Points:

 Access Methods: Sequential, Direct (Random), Indexed

 Directory Structures:

o Single-level

o Two-level

o Tree

o Acyclic Graph

📝 Example Questions:

 “What is the difference between sequential and indexed access?”

 “Name any two directory structures.”

🔶 7. I/O Management

🟩 Frequently Asked Topics:


 Device drivers

 Interrupt handling

 I/O techniques

📘 Key Concepts:

 I/O Techniques:

o Programmed I/O

o Interrupt-Driven I/O

o Direct Memory Access (DMA)

📝 Example Questions:

 “Which I/O technique reduces CPU involvement?”

 “What is the function of a device driver?”

🔶 8. Security and Protection

🟩 Frequently Asked Topics:

 Access control

 Authentication

 Encryption basics

📘 Key Concepts:

 Authentication: Verifying user identity.

 Access Control: Restricting unauthorized access.

 Encryption: Securing data in transit or storage.

🖥️ OPERATING SYSTEMS – In-Depth Notes

🔶 1. Basics of Operating Systems


✅ What is an Operating System?

An Operating System (OS) is a system software that acts as an interface between the user and
the hardware. It manages all computer resources such as CPU, memory, files, and devices.

✅ Key Functions:

1. Process Management – Handles execution of processes.

2. Memory Management – Allocates/deallocates memory.

3. File Management – Manages files and directories.

4. Device Management – Controls input/output devices.

5. Security – Ensures user authentication and data protection.

6. User Interface – CLI (e.g., Linux terminal) or GUI (e.g., Windows).

🔶 2. Types of Operating Systems

✅ (i) Batch Operating System

 Jobs are collected in batches and processed without user interaction.

 ❌ Slow and inflexible.

 ✅ Efficient for large-volume processing.

 Example: IBM punch-card systems.

✅ (ii) Time-Sharing OS

 Allocates a time slice (quantum) to each user/process.

 Fast response time.

 Example: UNIX.

✅ (iii) Real-Time OS (RTOS)

 Processes data instantly as it arrives.

 Used in embedded systems, robotics, aviation.

 Types:

o Hard RTOS – No delay tolerated (e.g., pacemakers).


o Soft RTOS – Some delays allowed (e.g., video streaming).

✅ (iv) Distributed OS

 Connects multiple computers via a network to appear as a single system.

 Example: LOCUS, Amoeba.

🔶 3. Process Management

✅ What is a Process?

A process is a program in execution, including program code, data, and system resources.

✅ Process States:

sql

CopyEdit

New → Ready → Running → Waiting → Terminated

✅ Process Control Block (PCB):

Stores process-related info:

 Process ID

 Program counter

 CPU registers

 Process state

 Memory limits

✅ Context Switching:

The process of saving the state of the current process and loading the state of another process.
Necessary for multitasking.

🔷 CPU Scheduling Algorithms

✅ 1. First Come First Serve (FCFS)

 Processes executed in the order of arrival.


 Non-preemptive.

 Poor performance if long process comes first (convoy effect).

✅ 2. Shortest Job First (SJF)

 Executes process with the shortest burst time.

 Optimal for average waiting time.

 Problem: Causes starvation for longer processes.

✅ 3. Round Robin (RR)

 Each process gets a fixed time slice.

 Preemptive.

 Ideal for time-sharing OS.

 Time Quantum is crucial (too small = overhead; too large = behaves like FCFS).

✅ 4. Priority Scheduling

 Each process is assigned a priority; higher priority runs first.

 May cause starvation.

 Solution: Aging (gradually increasing priority of waiting processes).

🟩 Example (FCFS):

Process Arrival Burst

P1 0 4

P2 1 3

P3 2 1

Turnaround Time = Completion - Arrival


Waiting Time = Turnaround - Burst

🔶 4. Memory Management

✅ Key Concepts:
➤ Contiguous Allocation:

 Entire process occupies a single block in memory.

 Easy but leads to fragmentation.

➤ Paging:

 Memory is divided into fixed-size pages.

 Logical address: page no + offset.

 No external fragmentation.

➤ Segmentation:

 Divides memory based on logical units (functions, arrays).

 Logical, variable size.

 May lead to external fragmentation.

➤ Virtual Memory:

 Extends RAM using disk space.

 Allows execution of large programs.

➤ Thrashing:

 Excessive page swapping → low CPU efficiency.

🔷 Page Replacement Algorithms

✅ 1. FIFO:

 Removes the oldest page first.

 Simple, but may replace frequently used pages.

✅ 2. LRU (Least Recently Used):

 Removes page that hasn't been used for the longest time.

 More accurate than FIFO but needs tracking.

✅ 3. Optimal:
 Replaces page not needed for the longest future use.

 Ideal but not practically implementable.

🔶 5. Deadlock

✅ Definition:

Deadlock occurs when multiple processes wait indefinitely for resources held by each other.

✅ Necessary Conditions (Coffman’s):

1. Mutual Exclusion – One process at a time.

2. Hold and Wait – Process holds one resource, waits for another.

3. No Preemption – Resources can't be forcibly taken.

4. Circular Wait – Circular chain of waiting.

✅ Handling Techniques:

 Prevention: Deny at least one condition.

 Avoidance: Banker’s Algorithm (safe state).

 Detection & Recovery: Use Resource Allocation Graph (RAG).

🔶 6. File Systems

✅ File: Collection of related data.

✅ Access Methods:

1. Sequential Access – Read line by line (e.g., tape).

2. Direct Access – Jump to any record (e.g., hard disk).

3. Indexed Access – Uses an index for fast retrieval.

✅ Directory Structures:

 Single-level: All files in one directory.

 Two-level: Separate directory for each user.


 Tree: Hierarchical, parent-child.

 Acyclic Graph: Allows shared sub-directories.

🔶 7. I/O Management

✅ Techniques:

1. Programmed I/O – CPU handles all operations.

2. Interrupt-Driven I/O – CPU interrupted only when I/O is ready.

3. DMA (Direct Memory Access) – Transfers directly between memory and device, CPU not
involved.

✅ Device Drivers:

 Software to manage and communicate with hardware.

🔶 8. Security and Protection

✅ Security: Protects system from external threats.

 Authentication (username/password, biometrics)

 Encryption (scrambles data to prevent access)

✅ Protection: Prevents internal misuse.

 Access rights, user permissions.

📝 Frequently Asked MCQ Samples (STET Style)

1. Which algorithm is non-preemptive?

o (a) Round Robin

o (b) FCFS ✅

o (c) Priority

o (d) None

2. Which is not a deadlock condition?


o (a) Mutual Exclusion

o (b) Hold and Wait

o (c) Resource Sharing ✅

o (d) Circular Wait

3. What is used in real-time OS?

o (a) Batch

o (b) Soft Interrupts

o (c) Scheduling

o (d) Real-time Scheduling ✅

top 5 Most Frequently Asked OS Questions:

1. Which scheduling algorithm uses time slice?


→ (Round Robin)

2. What is the role of the Process Control Block (PCB)?


→ (Holds process info: ID, state, registers, etc.)

3. Which condition is not necessary for deadlock?


→ (You must know all 4 conditions)

4. What is the difference between paging and segmentation?


→ (Fixed vs variable memory division)

5. In FIFO page replacement, which page is removed?


→ (Oldest page)

Practice MCQs – Operating Systems (With Answers & Explanations)

🔹 1. Which of the following scheduling algorithms uses a time quantum?

a) First-Come, First-Served
b) Shortest Job First
c) Round Robin
d) Priority Scheduling
✅ Answer: c) Round Robin
Explanation: Round Robin allocates a fixed time slice (quantum) to each process.

🔹 2. Which of the following is NOT a necessary condition for deadlock?

a) Mutual Exclusion
b) Preemption
c) Hold and Wait
d) Circular Wait

✅ Answer: b) Preemption
Explanation: Preemption prevents deadlock; "No Preemption" is actually the condition that
leads to it.

🔹 3. Which of the following best describes 'thrashing' in memory management?

a) When the system runs out of RAM


b) When too many processes are ready
c) Excessive page swapping
d) A type of segmentation error

✅ Answer: c) Excessive page swapping


Explanation: Thrashing reduces CPU efficiency due to constant page faults and disk I/O.

🔹 4. Which page replacement algorithm has the lowest page fault rate in ideal conditions?

a) FIFO
b) LRU
c) Optimal
d) Random

✅ Answer: c) Optimal
Explanation: Optimal algorithm replaces the page that won’t be used for the longest time in the
future.

🔹 5. In a multiprogramming environment, the OS keeps track of all processes using:


a) Program Counter
b) File Descriptor
c) Process Control Block
d) Scheduler

✅ Answer: c) Process Control Block


Explanation: PCB stores process-specific data like state, registers, and memory pointers.

🔹 6. Which access method is best suited for magnetic tapes?

a) Random
b) Indexed
c) Sequential
d) Direct

✅ Answer: c) Sequential
Explanation: Magnetic tapes are sequential access devices; random access is not feasible.

🔹 7. What is the main advantage of the paging memory management scheme?

a) Variable memory allocation


b) No need for secondary storage
c) Avoids internal fragmentation
d) Avoids external fragmentation

✅ Answer: d) Avoids external fragmentation


Explanation: Fixed-size pages fit into frames, eliminating external fragmentation.

🔹 8. What is context switching?

a) Transferring data between two devices


b) Changing state from user mode to kernel mode
c) Saving and loading process state during switching
d) Formatting a disk partition

✅ Answer: c) Saving and loading process state during switching


Explanation: Context switch happens when CPU switches from one process to another.
🔹 9. Which OS type is used in mission-critical systems like aircraft control?

a) Time-sharing
b) Real-Time
c) Batch
d) Network

✅ Answer: b) Real-Time
Explanation: RTOS offers guaranteed response times essential for real-world control systems.

🔹 10. Which of the following is not a file access method?

a) Direct
b) Indexed
c) Contiguous
d) Sequential

✅ Answer: c) Contiguous
Explanation: Contiguous is a file allocation method, not an access method.

🔥 Top 50 Operating Systems MCQs for Bihar STET Paper 2

1. Which OS type uses a time slice to allocate CPU?

a) FCFS
b) Round Robin
c) SJF
d) Priority
Answer: b) Round Robin

2. What is a process?

a) A program in execution
b) A program in memory
c) A file on disk
d) CPU register
Answer: a) A program in execution

3. The Process Control Block (PCB) contains:


a) Program code only
b) Process state and registers
c) File descriptors
d) User data
Answer: b) Process state and registers

4. Which scheduling algorithm may cause starvation?

a) FCFS
b) Round Robin
c) Priority scheduling
d) SJF
Answer: c) Priority scheduling

5. Deadlock occurs when:

a) Processes run normally


b) Processes wait indefinitely for resources
c) CPU is idle
d) Processes are terminated
Answer: b) Processes wait indefinitely for resources

6. Which is NOT a necessary condition for deadlock?

a) Mutual exclusion
b) Hold and wait
c) Resource preemption
d) Circular wait
Answer: c) Resource preemption

7. What does “context switching” mean?

a) Switching between two tasks


b) Saving and loading process state
c) Allocating memory
d) Writing files to disk
Answer: b) Saving and loading process state

8. FIFO page replacement algorithm replaces:

a) The most recently used page


b) The oldest page in memory
c) The page used least recently
d) A random page
Answer: b) The oldest page in memory

9. Which is an example of real-time OS?

a) Windows
b) UNIX
c) QNX
d) Linux
Answer: c) QNX

10. Paging avoids:

a) Internal fragmentation
b) External fragmentation
c) Segmentation
d) Thrashing
Answer: b) External fragmentation

11. What is thrashing?

a) CPU idle state


b) Excessive paging in and out
c) Process execution
d) Memory allocation
Answer: b) Excessive paging in and out

12. The time a process spends waiting in the ready queue is called:

a) Burst time
b) Waiting time
c) Turnaround time
d) Response time
Answer: b) Waiting time

13. Virtual memory allows:

a) Execution of large programs using disk space


b) Only small programs to run
c) No paging
d) Direct memory access
Answer: a) Execution of large programs using disk space
14. Which I/O method lets devices transfer data directly to memory?

a) Programmed I/O
b) Interrupt-driven I/O
c) Direct Memory Access (DMA)
d) Polling
Answer: c) Direct Memory Access (DMA)

15. The directory structure that supports hierarchical files is:

a) Single-level
b) Two-level
c) Tree structure
d) Flat
Answer: c) Tree structure

16. What is the major function of an OS?

a) Compile programs
b) Manage hardware and resources
c) Write code
d) Encrypt data
Answer: b) Manage hardware and resources

17. Which scheduling algorithm gives minimum average waiting time?

a) FCFS
b) Round Robin
c) SJF
d) Priority
Answer: c) SJF

18. The CPU scheduler decides:

a) Which process will be allocated CPU next


b) Memory allocation
c) File storage
d) Device management
Answer: a) Which process will be allocated CPU next

19. Which of the following is NOT true about batch OS?


a) Processes jobs in batches
b) User interaction is minimal
c) Provides fast response to user
d) Early type of OS
Answer: c) Provides fast response to user

20. The primary memory used by the OS to hold the OS code is:

a) RAM
b) ROM
c) Cache
d) Virtual memory
Answer: a) RAM

21. In round robin scheduling, time quantum is:

a) Size of memory
b) Time allocated to each process
c) Total CPU time
d) Time between interrupts
Answer: b) Time allocated to each process

22. What is aging in CPU scheduling?

a) Process termination
b) Gradually increasing priority of waiting processes
c) Reducing CPU speed
d) Memory cleanup
Answer: b) Gradually increasing priority of waiting processes

23. Which file access method allows jumping directly to the desired record?

a) Sequential
b) Indexed
c) Direct
d) None of the above
Answer: c) Direct

24. Which of the following is NOT part of OS security?

a) Authentication
b) Encryption
c) Compilation
d) Access control
Answer: c) Compilation

25. Mutual exclusion in deadlock means:

a) Multiple processes access resource simultaneously


b) Only one process accesses a resource at a time
c) Processes communicate
d) None of these
Answer: b) Only one process accesses a resource at a time

26. In segmentation, memory is divided based on:

a) Fixed size pages


b) Logical units like functions
c) Random allocation
d) None of the above
Answer: b) Logical units like functions

27. A state when a process is waiting for a resource is called:

a) Ready
b) Running
c) Waiting/Blocked
d) New
Answer: c) Waiting/Blocked

28. Which of these is NOT an OS service?

a) Program execution
b) File system manipulation
c) Code debugging
d) Resource allocation
Answer: c) Code debugging

29. The command line interface of an OS is called:

a) GUI
b) Shell
c) Desktop
d) Kernel
Answer: b) Shell

30. In demand paging, when a page is not in memory, it causes:

a) Interrupt
b) Page fault
c) Deadlock
d) CPU overload
Answer: b) Page fault

31. A device driver is:

a) Hardware
b) Software to control hardware
c) Part of CPU
d) File system
Answer: b) Software to control hardware

32. Which process state transition happens when CPU finishes execution?

a) New → Ready
b) Ready → Running
c) Running → Terminated
d) Waiting → Ready
Answer: c) Running → Terminated

33. Which of the following is NOT a page replacement algorithm?

a) FIFO
b) LRU
c) SJF
d) Optimal
Answer: c) SJF

34. The primary function of the kernel is to:

a) Provide user interface


b) Manage system resources
c) Write files
d) Schedule exams
Answer: b) Manage system resources
35. Which of the following is NOT true about virtual memory?

a) Extends RAM using disk space


b) Allows running large programs
c) Removes internal fragmentation
d) Uses paging or segmentation
Answer: c) Removes internal fragmentation

36. A process that is ready but not running is in:

a) New
b) Ready
c) Running
d) Waiting
Answer: b) Ready

37. In CPU scheduling, response time is:

a) Time to complete execution


b) Time to start execution after submission
c) Total waiting time
d) Burst time
Answer: b) Time to start execution after submission

38. Which of the following OS is NOT multitasking?

a) Windows
b) Linux
c) DOS
d) UNIX
Answer: c) DOS

39. Which of these is a single-level directory structure disadvantage?

a) Easy to implement
b) Name conflicts between files
c) Users can’t create files
d) Supports multi-users
Answer: b) Name conflicts between files

40. The CPU scheduling algorithm best suited for time-sharing systems is:
a) FCFS
b) SJF
c) Round Robin
d) Priority
Answer: c) Round Robin

41. Which one of these is NOT a function of the OS?

a) Memory management
b) Process scheduling
c) Network routing
d) File management
Answer: c) Network routing

42. What happens during a deadlock?

a) Processes execute normally


b) Processes terminate normally
c) Processes wait forever
d) CPU idle time increases
Answer: c) Processes wait forever

43. The primary job of the scheduler is to:

a) Manage files
b) Select which process runs next
c) Manage memory
d) Handle input/output devices
Answer: b) Select which process runs next

44. Which of the following is NOT a memory management technique?

a) Paging
b) Segmentation
c) Compiling
d) Virtual memory
Answer: c) Compiling

45. Which of the following are examples of secondary storage?

a) RAM
b) CPU Cache
c) Hard Disk
d) Registers
Answer: c) Hard Disk

46. Which scheduling algorithm is non-preemptive?

a) Round Robin
b) Priority
c) SJF (non-preemptive)
d) FCFS
Answer: d) FCFS

47. Which of the following is NOT true about file systems?

a) Organize data on storage devices


b) Manage file permissions
c) Schedule CPU processes
d) Provide file access methods
Answer: c) Schedule CPU processes

48. Which of the following is NOT part of deadlock prevention?

a) Denying mutual exclusion


b) Denying hold and wait
c) Circular wait allowed
d) Resource preemption
Answer: c) Circular wait allowed

49. Which one of the following is NOT a type of Operating System?

a) Batch OS
b) Network OS
c) Programming OS
d) Real-Time OS
Answer: c) Programming OS

50. The 'Ready' queue contains:

a) Processes waiting for CPU


b) Processes waiting for I/O
c) Processes terminated
d) Processes just created
Answer: a) Processes waiting for CPU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy