OPERATING SYSTEM
Introduction to OS
Let's understand OS from a real-life example → Imagine an example of a restaurant.
Now the restaurant has a waiter, customers, and a restaurant manager.
Customer (User) orders food → Requests a task (e.g., opening an app).
Waiter (OS) takes the order → Acts as an intermediary.
Waiter delivers the order to the kitchen (CPU) → Sends the request for processing.
Chef (CPU) prepares the food → Executes the task.
Waiter serves the food to the customer → Returns the processed output.
Waiter manages multiple customers efficiently → Handles multitasking and resource
allocation.
The waiter (OS) acts as a middleman between the customer (user) and the kitchen (CPU),
ensuring smooth communication and efficient service.
An Operating System (OS) is like the waiter of a restaurant that ensures everything runs
smoothly between customers, chefs, and the manager.
The application makes a system call
Application softwre provide tools for specific tasks
Pre-installed-windows,macos
1. Operating System Meaning
An operating system is like the manager of a theater. Just as a theater manager coordinates
the actors, stage crew, and audience to ensure a smooth performance, an OS manages the
computer's hardware and software resources, facilitating communication between the user
and the machine.
Technical Example: Windows, macOS, and Linux are popular operating systems that manage
files, run applications, and connect to hardware devices.
MCQs:
1. What is the primary role of an operating system?
o a) To provide internet access
o b) To manage hardware and software resources
o c) To create software applications
o d) To design hardware components
Answer: b) To manage hardware and software resources
2. Which of the following is NOT an operating system?
o a) Linux
o b) Microsoft Word
o c) Windows
o d) macOS
Answer: b) Microsoft Word
3. An operating system acts as an intermediary between:
o a) Hardware and software
o b) User and hardware
o c) User and software
o d) All of the above
Answer: d) All of the above
4. Which component of the computer does the operating system manage?
o a) Memory
o b) Processor
o c) Input/Output devices
o d) All of the above
Answer: d) All of the above
5. The core of an operating system is called:
o a) Shell
o b) Kernel
o c) Command Line
o d) Interface
Answer: b) Kernel
2. Supervisor & User Mode
Think of this as driving a car. The "supervisor mode" (also known as kernel mode) is like a
mechanic who can access and modify all parts of the car, including the engine. The "user
mode" is like a regular driver who can operate the car but doesn't have access to its internal
mechanics. In computers, supervisor mode allows the OS to execute critical tasks with full
access to hardware, while user mode restricts applications from performing potentially
harmful operations.
Technical Example: When you run a web browser, it operates in user mode, preventing it
from directly accessing the hardware. However, the OS operates in supervisor mode to
manage system resources.
MCQs:
1. What is another name for Supervisor Mode?
o a) User Mode
o b) Kernel Mode
o c) Application Mode
o d) System Mode
Answer: b) Kernel Mode
2. In which mode do standard user applications run?
o a) Supervisor Mode
o b) Kernel Mode
o c) User Mode
o d) Admin Mode
Answer: c) User Mode
3. Why is User Mode used?
o a) To allow direct hardware access
o b) To restrict applications from accessing critical system resources
o c) To speed up system performance
o d) To allow users to modify the OS
Answer: b) To restrict applications from accessing critical system resources
4. Switching from User Mode to Supervisor Mode is called:
o a) Mode Switching
o b) Context Switching
o c) Privilege Escalation
o d) System Call
Answer: d) System Call
5. Which mode has unrestricted access to all system resources?
o a) User Mode
o b) Supervisor Mode
o c) Application Mode
o d) Protected Mode
Answer: b) Supervisor Mode
3. Types of Operating Systems
a) Simple Batch Systems: Imagine a laundry service where clothes are collected from
multiple customers and washed together in batches. Similarly, in batch systems, tasks are
collected and processed in groups without user interaction during processing.
Technical Example: Early computers used batch processing to execute jobs sequentially
without manual intervention.
b) Multiprogramming Systems:
Imagine a chef in a restaurant preparing multiple dishes simultaneously. Instead of cooking
one dish at a time, they start another while waiting for the first to finish. Similarly,
multiprogramming OS allows multiple programs to be loaded in memory at the same time,
increasing CPU utilization by running another task when one is waiting for input/output.
Example in Tech:
Windows and Linux use multiprogramming when you open multiple applications, like a
browser, music player, and code editor, all running at once.
c) Multiprocessing Systems:
Think of a modern kitchen where multiple chefs (processors) work on different tasks at the
same time. Multiprocessing OS uses multiple processors (CPUs) to execute multiple tasks
simultaneously, improving speed and reliability.
Example in Tech:
Servers and high-end gaming PCs use multiple cores (Quad-core, Octa-core) to handle
multiple tasks efficiently.
d) Multitasking Systems:
Imagine a juggler handling multiple balls at the same time, giving attention to each for a
short moment. Multitasking OS allows users to run multiple applications simultaneously by
quickly switching between them.
Example in Tech:
Windows allows you to browse the internet while listening to music and downloading files
simultaneously.
e) Parallel Processing Systems:
Think of a construction site where multiple workers (processors) build different parts of a
house at the same time. Parallel processing OS divides a single complex task into smaller
ones and executes them concurrently on multiple processors.
Example in Tech:
Supercomputers use parallel processing for weather forecasting, simulations, and AI training.
f) Distributed Systems:
Imagine a food delivery service like Zomato or Swiggy, where orders are distributed among
multiple restaurants and delivery agents. Distributed OS connects multiple computers over a
network to share resources and process tasks collaboratively.
Example in Tech:
Cloud computing services (Google Drive, AWS, Microsoft Azure) use distributed OS
principles.
g) Real-Time Operating Systems (RTOS):
Think of an air traffic control system where immediate response is required to avoid
accidents. RTOS ensures real-time responses within strict time limits, making them ideal for
time-sensitive applications.
Example in Tech:
RTOS is used in robotics, medical devices (pacemakers), and automotive control systems
(self-driving cars).
MCQs for Types of Operating Systems
1. Which OS type is designed for executing multiple programs by switching between
them efficiently?
o a) Batch Processing OS
o b) Multiprogramming OS
o c) Real-Time OS
o d) Distributed OS
o Answer: b) Multiprogramming OS
2. Which type of OS uses multiple processors to improve speed and efficiency?
o a) Multiprocessing OS
o b) Multitasking OS
o c) Distributed OS
o d) Batch OS
o Answer: a) Multiprocessing OS
3. Cloud computing platforms like AWS and Google Drive use which type of OS
concept?
o a) Parallel Processing OS
o b) Multiprocessing OS
o c) Distributed OS
o d) Multitasking OS
o Answer: c) Distributed OS
4. Which OS is used in time-sensitive applications like self-driving cars and medical
devices?
o a) Batch OS
o b) Real-Time OS
o c) Multiprocessing OS
o d) Distributed OS
o Answer: b) Real-Time OS
5. Which OS type processes jobs in batches without user interaction during
execution?
o a) Batch Processing OS
o b) Multiprogramming OS
o c) Parallel OS
o d) Multitasking OS
o Answer: a) Batch Processing OS
4. OS Structure
The OS structure defines how different components of the operating system are organized
and interact with each other.
Monolithic Kernel: All OS services are contained in a single large program. Example:
Linux.
Microkernel: Only essential services run in the kernel, and other functions run in
user space. Example: macOS.
Layered Architecture: The OS is divided into layers, each with a specific function.
Example: Windows NT.
Hybrid Kernel: A mix of monolithic and microkernel architectures. Example:
Windows 10.
5. System Calls
A system call acts as a bridge between user applications and the operating system. It allows
applications to request services from the OS, such as file operations, memory management,
and process creation.
Example in Tech:
When you open a file in Notepad, it makes a system call to the OS to read the file from the
disk.
6. Functions of OS
The OS performs several key functions:
Process Management: Handles running applications.
Memory Management: Allocates memory to processes.
File System Management: Organizes and stores files.
Device Management: Communicates with hardware like printers and keyboards.
Security & Access Control: Protects against unauthorized access.
7. Evolution of Operating Systems
Operating systems have evolved from simple batch systems to sophisticated modern OS:
1950s: Batch processing systems.
1960s-70s: Time-sharing systems (multiple users).
1980s: GUI-based OS like Windows, macOS.
1990s-2000s: Mobile OS like Android, iOS.
Present: AI-powered and cloud-based OS.
8. Process Management
A process is a running instance of a program.
Key Concepts:
Process Control Block (PCB): Stores information about each process (Process ID,
state, memory, etc.).
Process States:
o New: Process is created.
o Ready: Waiting for CPU.
o Running: Currently executing.
o Waiting: Waiting for input/output.
o Terminated: Process completed.
Operations on Processes:
Process Creation: A new process is started (e.g., opening Chrome).
Process Termination: A process ends (e.g., closing a game).
Process Scheduling: The OS decides which process to run next.
Co-operating vs. Independent Processes
Co-operating Processes: Share data and communicate (e.g., Google Docs editing in
real time).
Independent Processes: Run separately without sharing data (e.g., watching a video
while writing code).
MCQs for Process Management
1. What does PCB stand for?
o a) Process Control Block
o b) Program Code Block
o c) Process Communication Block
o d) Parallel Control Block
o Answer: a) Process Control Block
2. Which process state means a process is waiting for an event (e.g., user input)?
o a) New
o b) Ready
o c) Waiting
o d) Running
o Answer: c) Waiting
3. What is the primary function of a Process Control Block (PCB)?
o a) Stores information about a process
o b) Manages network connections
o c) Allocates memory to hardware devices
o d) Handles user authentication
o Answer: a) Stores information about a process
4. What is an example of a cooperating process?
o a) Writing a document in MS Word while listening to music
o b) Two users playing an online multiplayer game
o c) Running a virus scan and browsing the internet
o d) All of the above
o Answer: b) Two users playing an online multiplayer game
5. Which process scheduling algorithm does Windows use?
o a) First-Come-First-Serve
o b) Round Robin
o c) Shortest Job Next
o d) Priority Scheduling
o Answer: b) Round Robin
9. Co-operating and Independent Processes
A process is a running program. Processes can be classified into Co-operating and
Independent processes.
Co-operating Processes
Think of a Google Docs file where multiple users edit the same document in real time. These
users’ edits are shared, so their processes are co-operating.
Definition:
Processes that share data and communicate with each other.
These processes increase computational speed, modularity, and convenience.
Tech Example:
Web browsers and download managers: When you download a file in Chrome, the
browser and the OS's file system co-operate to save the file.
Multiplayer online games: Different players interact in the same game world (like
PUBG, Call of Duty).
Independent Processes
Imagine writing a document in Notepad while playing a song in Spotify. These two programs
do not share data, so they are independent.
Definition:
Processes that do not affect each other.
No shared memory or communication between them.
Tech Example:
Opening Microsoft Word while listening to music on VLC Media Player – both
processes run separately.
Running a calculator and a file explorer at the same time – they don’t depend on
each other.
MCQs for Co-operating and Independent Processes
1. Which of the following is an example of co-operating processes?
o a) Watching a YouTube video while writing a document
o b) Two users collaborating on Google Docs
o c) Running a calculator and opening a PDF file
o d) Playing a video game and typing a report
Answer: b) Two users collaborating on Google Docs
2. Which process does NOT share data with others?
o a) Co-operating process
o b) Independent process
o c) Multithreaded process
o d) Inter-process communication process
Answer: b) Independent process
3. A multiplayer online game where players interact is an example of:
o a) Independent process
o b) Batch process
o c) Co-operating process
o d) Kernel process
Answer: c) Co-operating process
4. Which of these does NOT require process cooperation?
o a) Downloading a file and browsing the web
o b) Running two separate video players
o c) Client-server communication in a chat application
o d) Editing a shared spreadsheet in Excel
Answer: b) Running two separate video players
5. Which of these is an advantage of co-operating processes?
o a) Faster user interface
o b) Reduced CPU usage
o c) Increased computational speed and resource sharing
o d) Decreased memory usage
Answer: c) Increased computational speed and resource sharing
10. Process States
A process goes through different states during its execution, just like a person moving
through different stages of life (childhood → school → work → retirement).
Process States and Life Cycle
1. New → Process is created but not yet ready to run.
o Example: When you click on a game icon, the game loads into memory but
hasn’t started yet.
2. Ready → Process is waiting for CPU time.
o Example: Your game is loaded but waiting for you to press ‘Start’.
3. Running → The process is executing on the CPU.
o Example: You start playing the game, and it actively uses the processor.
4. Waiting (Blocked) → The process is waiting for input/output (I/O) to complete.
o Example: Your game is waiting for an internet connection before loading new
data.
5. Terminated (Exit) → Process has finished execution.
o Example: You exit the game, and it closes completely.
Process Life Cycle in a Real-Life Scenario
Example: Watching a YouTube Video
1. New: Clicking on the YouTube app opens the process.
2. Ready: The app loads and waits for user interaction.
3. Running: You play a video, and the app actively uses CPU resources.
4. Waiting: The video buffers (waiting for internet data).
5. Terminated: You close the YouTube app.
MCQs for Process States
1. Which process state means a process is actively using the CPU?
o a) New
o b) Ready
o c) Running
o d) Waiting
Answer: c) Running
2. What happens when a process is in the "Waiting" state?
o a) It is waiting for CPU time
o b) It has finished execution
o c) It is waiting for input/output (I/O) operations
o d) It is deleted from memory
Answer: c) It is waiting for input/output (I/O) operations
3. A process enters the Terminated state when:
o a) The user closes the application
o b) The process is waiting for CPU
o c) The process is still executing
o d) The process is blocked
Answer: a) The user closes the application
4. Which state comes before the Running state?
o a) New
o b) Ready
o c) Waiting
o d) Terminated
Answer: b) Ready
5. Which of these is NOT a process state?
o a) Ready
o b) Suspended
o c) Terminated
o d) Sleeping
Answer: d) Sleeping
11. Operations on Processes
The operating system performs several operations on processes:
1. Process Creation
A new process is created.
Example: Opening Chrome creates a new process for the browser.
2. Process Termination
A process finishes execution and is removed from memory.
Example: Closing a game stops the process.
3. Process Scheduling
The OS decides which process gets CPU time.
Example: When multiple apps are open, the OS schedules CPU time for each.
4. Process Synchronization
Ensures that multiple processes work together smoothly.
Example: Two people editing the same Google Docs file simultaneously.
5. Inter-process Communication (IPC)
Processes exchange data with each other.
Example: When you download a file in Chrome, it communicates with the OS to store
it.
MCQs for Operations on Processes
1. Which operation removes a process from memory?
o a) Process Scheduling
o b) Process Synchronization
o c) Process Termination
o d) Process Creation
Answer: c) Process Termination
2. Process scheduling helps in:
o a) Storing files on the system
o b) Deciding which process runs next
o c) Deleting unnecessary applications
o d) Running only one process at a time
Answer: b) Deciding which process runs next
3. Which OS operation allows processes to communicate with each other?
o a) Process Termination
o b) Inter-process Communication (IPC)
o c) Process Scheduling
o d) File Management
Answer: b) Inter-process Communication (IPC)
4. Which of the following is NOT an operation on processes?
o a) Process Creation
o b) Process Synchronization
o c) Process Elimination
o d) Process Termination
Answer: c) Process Elimination
5. What does the OS use to decide which process runs next?
o a) Process Termination
o b) Process Scheduling
o c) Process Execution
o d) Process Swapping
Answer: b) Process Scheduling