Operating System Unit 4
Operating System Unit 4
Operating System:
Definition:
Batch Processing is a type of operating system where similar jobs are
grouped (batched) together and executed one after another without user
interaction during execution.
Jobs are collected, grouped, and processed in batches.
Users submit jobs to an operator, who loads them onto a storage device.
The OS then processes these jobs automatically in the order they were
received.
How It Works:
Users submit their jobs using punch cards, magnetic tapes, or files.
Jobs are grouped into a batch.
The system processes all jobs in the batch one by one.
Output is collected and given back to the user later.
Key Features:
No direct user interaction during execution.
Jobs are executed sequentially.
Uses job control language (JCL) to instruct the OS on job execution.
Efficient for repetitive and large-scale tasks.
Advantages:
Efficient for large volumes of similar tasks (e.g., payroll, bank statements).
Reduces idle CPU time.
Simple and predictable job execution.
Disadvantages:
No real-time interaction – users can't interfere during execution.
Debugging is hard – errors are found only after the batch finishes.
Longer wait times for jobs, especially if the batch is large.
Q4. Multi-Programming :-
Definition:
A Multiprogramming Operating System allows multiple programs to
reside in memory at the same time and execute concurrently by sharing
CPU time. While one program waits (e.g., for I/O), another can use the
CPU, increasing efficiency.
How It Works:
Multiple programs are loaded into memory.
The CPU executes one program at a time.
When a program waits for I/O (e.g., reading from disk), the CPU switches
to another program.
This continues in a cycle, so the CPU is never idle.
Key Concept:
The CPU is always busy — it switches between programs to maximize
resource use and reduce idle time.
Key Features:
Increased CPU utilization
Simultaneous execution (not at the same exact time, but switching
quickly between tasks)
Uses job scheduling algorithms (like FCFS, SJF, Round Robin)
Requires memory management and process management
Advantages:
Better CPU and resource utilization
Faster job completion compared to batch systems
Reduced idle time for CPU and other components
Disadvantages:
Requires more memory and complex OS design
Can cause issues like deadlocks or priority conflicts
Slower response compared to real-time or time-sharing systems
Definition:
A Multitasking Operating System allows a user to perform multiple tasks
(programs) simultaneously. The CPU switches rapidly between tasks,
giving the illusion that they are running at the same time.
Example: You are listening to music while browsing the web and
writing a document — all at once.
How It Works:
The CPU allocates a small time slice to each task.
After each slice, the OS quickly switches to the next task (this is called
context switching).
Because this switching happens quickly, all tasks seem to run
concurrently.
Types of Multitasking:
1. Preemptive Multitasking
The OS decides when to switch tasks (forces it after a set time).
Ensures fair CPU sharing.
Examples: Windows, Linux, macOS.
2. Cooperative Multitasking
A task voluntarily gives control to the next task.
Less reliable (a frozen program can block others).
Examples: Older systems like Windows 3.x, Mac OS 9.
Key Functions:
Process scheduling
Context switching
CPU time allocation
Resource sharing
Advantages:
Efficient CPU utilization
Improved productivity — multiple applications can run together.
Better user experience with smooth task switching.
Disadvantages:
Requires more memory and CPU power.
Overhead from frequent context switching.
Risk of system slowdowns if too many processes run at once.
Q6. Multi-Processing :-
**Definition:
A** Multiprocessing Operating System is an OS that supports the use of
two or more CPUs (processors) in a single computer system. These
processors work simultaneously to execute multiple processes at the
same time, significantly boosting performance and reliability.
How It Works:
Each processor can execute a different process in parallel.
The OS manages task distribution, synchronization, and communication
between processors.
This differs from multitasking, where only one CPU is switching between
tasks.
Key Features:
True parallel processing of tasks.
Shared memory or distributed memory depending on the architecture.
Requires complex scheduling and communication control.
Provides better fault tolerance — one processor can keep working if
another fails.
Types of Multiprocessing:
1. Symmetric Multiprocessing (SMP)
All processors are treated equally.
They share the same memory and I/O.
Common in most modern systems.
Example: Windows, Linux, macOS on multi-core CPUs.
Advantages:
Greatly increases system performance.
Can handle multiple tasks truly in parallel.
Improves system reliability and availability.
Useful for scientific, engineering, and database applications.
Disadvantages:
Expensive hardware (multiple CPUs or cores).
Complex OS design for managing processors and memory.
Software needs to be designed to take full advantage of multiple CPUs.
Q7. Time-Sharing :-
Definition:
A Time-Sharing Operating System is a type of OS that allows multiple
users or processes to use the computer system at the same time by
sharing CPU time. Each task or user gets a small, fixed time slot (called a
time slice) to use the CPU.
If there are n users actively requesting service at one time, each user will
only
see on the average 1/n of the effective computer capacity, not counting
OS overhead.
How It Works:
The CPU rapidly switches between tasks or users.
Each task is assigned a short time quantum.
After its time is up, the OS moves to the next task, and so on.
If a task finishes before the time expires, the next task starts immediately.
Key Features:
Multi-user support – many users can access the system at once (e.g., on
terminals).
Fast response time – quick switching makes it feel "instant."
Efficient resource utilization – CPU, memory, and I/O devices are shared.
Preemptive scheduling – tasks are forcefully paused if they exceed their
time slot.
Advantages:
Interactive user experience – users feel like they have their own system.
Reduces CPU idle time.
Effective for multi-user environments like servers and mainframes.
Disadvantages:
Overhead due to frequent context switching.
Can become slow if too many users or tasks are active.
Security and data isolation between users are more complex.