operating system notes
operating system notes
advantages .
What is a Virtual Machine?
A Virtual Machine (VM) is a system that creates an illusion of a real machine. This means that even
though we have only one physical computer, we can make it act like many computers using special
software called a Virtual Machine OS (like VMware, VirtualBox, etc.).
Example:
Imagine you have one big house but you divide it into multiple rooms with separate keys. Now,
different people can live in their own rooms as if they have their own house, even though it is
actually a single house.
Similarly, one computer (physical machine) can be divided into multiple virtual machines, where
each can have its own Operating System (OS), storage, and applications.
A virtual machine system gives an illusion that each user has their own personal computer. It does
this by simulating:
1. Virtual Processor – Each VM gets a part of the CPU, making it feel like it has its own
processor.
2. Virtual Storage & I/O devices – Each VM gets its own space on the hard disk and has access
to input/output devices like printers.
The operating system manages this by sharing the CPU among multiple virtual machines using a
technique called Process Scheduling.
Example:
Think of a school bus where many students travel together. Even though it is one bus, each student
feels like they have their own seat. Similarly, in a virtual machine setup, multiple users feel like they
have their own computer, but actually, they are sharing a single powerful machine.
Diagram Explanation
Multiple virtual machines, each with its own OS (OS1, OS2, OS3).
This means that even though there is only one physical machine, multiple virtual machines are
running independently, just like different students using the same school bus.
Advantages of Virtual Machines
o You can run Windows, Linux, and macOS on the same computer at the same time.
o Example: A software tester can test an app on Windows and Linux without needing
two separate computers.
o But with VMs, you can run both Windows and Linux on the same computer without
modifying the program.
o Example: A gaming company can check if their game works properly on both
Windows and macOS using virtual machines.
o Since each VM is independent, if one VM gets a virus, it does not affect the other
VMs or the main computer.
o Example: If a hacker attacks one virtual machine, the other virtual machines remain
safe.
Final Summary
A Virtual Machine (VM) allows a single computer to behave like multiple computers.
It is useful for testing software, security, and running different programs without converting
them.
An Operating System (OS) is software that helps to manage computer hardware and software
resources. It can process tasks in two ways:
Example:
Serial Processing: If you are washing clothes, you will first wash one shirt, then another, and
so on.
Concurrent Processing: If you are washing clothes while also watching TV, both tasks happen
together.
1. Serial Processing
2. Batch Processing
3. Multiprogramming
1. Serial Processing
In this method, each step in a program requires manual interference, meaning a human must
complete each step before moving to the next.
This takes time, and after every step, a person must be involved.
It leads to low resource utilization (CPU sits idle while waiting for input).
Early computers used punched cards and paper tapes for input.
2. Batch Processing
To solve the problem of Serial Processing, Batch Processing was introduced.
In Batch Processing, multiple jobs (programs with similar requirements) are grouped
together and executed automatically without manual interference.
Similarly, in computers:
sql
CopyEdit
3. Multiprogramming
Even though Batch Processing helped, computers still wasted time when waiting for input/output
operations.
To improve efficiency, Multiprogramming was introduced.
When one program is waiting for input/output, the CPU switches to another program.
Example of Multiprogramming
Imagine a chef in a restaurant:
1. The chef is cooking Dish 1 but has to wait for water to boil.
3. When the water boils, the chef returns to Dish 1 and continues.
Similarly, in computers:
Sequential Execution (Old method): Program 1 runs fully, then Program 2 starts.
Multiprogramming Execution (New method): The CPU switches between Program 1 and
Program 2.
Advantages of Multiprogramming
Challenges in Multiprogramming
Final Understanding
2. Batch Processing – Grouping similar jobs, automatic execution, faster than serial.
3. Multiprogramming – Multiple jobs run together, CPU switches between tasks, fastest
method.
Batch Processing → A restaurant preparing multiple orders of the same dish together.
Multiprogramming → A chef cooking multiple dishes at the same time by switching between
them.
# Services provide by the an operating system .
1) User Interface
The OS provides a way for users to interact with the computer.
Command-Line Interface (CLI): Users type commands to operate the system.
Example: Using the command prompt (cmd) in Windows or Terminal in Linux.
Graphical User Interface (GUI): Users interact using a mouse, windows, and menus.
Example: Windows, macOS, and Android.
Example:
If you want to open a file, in CLI, you type open file.txt, but in GUI, you just double-click the
file.
2) Program Execution
The OS allows us to run applications. It manages the resources (CPU, memory, etc.) needed
for execution.
Example:
When you open a web browser like Chrome, the OS ensures it gets the necessary CPU and
memory to run smoothly.
3) I/O Operations
Programs need to interact with input/output (I/O) devices like keyboards, mice, printers, and
USB drives. The OS handles these operations.
Example:
When you type in Notepad, your keyboard’s input goes to the OS, which then displays it on
the screen.
5) Communication
Processes (programs running at the same time) need to communicate with each other. This
happens in two ways:
Inter-process Communication (IPC): Two programs on the same computer exchange
data. Example: A media player fetching a song from a file explorer.
Network Communication: Two computers exchange data over the internet. Example:
WhatsApp messages between two users.
6) Error Detection
The OS continuously checks for errors and tries to fix them. Errors can be:
Memory Error: Insufficient RAM to run an application.
Connection Failure: Internet disconnects while downloading a file.
I/O Device Failure: Printer not responding.
Example:
If your computer crashes while running an app, the OS may show a "Blue Screen of Death"
(BSOD) in Windows or automatically restart the app.
7) Resource Allocation
The OS distributes resources (CPU, memory, files, I/O devices) among different programs and
users.
Example:
When playing a game and using a web browser at the same time, the OS ensures both get
CPU and RAM properly.
9) Accounting
The OS keeps records of how resources are used, which helps in optimizing performance and
security.
Example:
On your phone, the "Battery Usage" section shows which apps use the most power, helping
you manage battery life.
Final Thoughts
The OS acts as a manager of all computer activities. Without it, using a computer would be
extremely difficult.
Conclusion
Multicore systems are like a single kitchen with multiple chefs (cores) inside one
CPU.
Multiprocessor systems are like multiple kitchens, each with its own chefs (separate
CPUs).
Both systems improve performance, but multicore processors are common in
personal computers, while multiprocessor systems are used in large servers.
Best Choice?
If you need gaming, video editing, or multitasking, a multicore processor is enough.
If you are running huge databases, cloud computing, or high-performance servers, a
multiprocessor system is better.
There are different types of operating systems (OS), and some of the important ones are:
1. Batch Processing System
2. Uni-Programming System
3. Multi-Programming System
4. Time Sharing System
5. Clustered System
6. Distributed System
7. Network Operating System
8. Real-Time System
3. Uni-Programming System
Concept:
In this system, only one program runs at a time.
If the program needs input/output (I/O) or an exception occurs, the processor waits
until the task is completed.
Example:
Suppose you are writing a document in Notepad. While typing, if you start printing,
the system will wait until printing is complete before allowing you to continue typing.
Disadvantage:
Processor remains idle when waiting for I/O, which wastes time.
4. Multi-Programming System
Concept:
In this system, multiple programs are loaded into memory and the CPU switches
between them.
When one program is waiting (for input/output), the CPU executes another program.
Example:
Suppose you are downloading a file, listening to music, and browsing the internet.
While the download is in progress (waiting for the network), the system continues
playing music and allowing web browsing.
Advantage:
✅ CPU never stays idle, which improves efficiency.
5. Time-Sharing System
Concept:
This is an extension of multi-programming where multiple users can use the system
at the same time.
The CPU divides time into small slots and switches between different processes
quickly, so every user gets a response.
Example:
Imagine a school computer lab where 10 students are using the same server. The OS
ensures that all students get equal time to use the processor.
Advantages:
✅ Easy to use.
✅ User-friendly.
✅ Acts as a bridge between hardware and software.
Disadvantages:
❌ If the OS crashes, all users may lose their work.
❌ Unauthorized users can misuse the system.
6. Clustered System
Concept:
A group of computers is connected together using a high-speed communication link.
Each computer has its own memory and devices but works as a single unit.
Clustering improves system availability (less downtime).
Types of Clustering:
1. Asymmetric Clustering – One computer (master) controls others (slaves).
2. Symmetric Clustering – All computers share the workload equally.
Example:
Google uses a cluster of thousands of computers to handle search queries quickly
and efficiently.
Conclusion
Batch processing is used for processing multiple similar jobs without user
interaction.
Uni-programming runs one job at a time but wastes CPU time.
Multi-programming allows multiple programs to run by switching between them.
Time-sharing extends multi-programming for multiple users.
Clustered systems use multiple computers to improve efficiency and reliability.