0% found this document useful (0 votes)
3 views29 pages

OS Lecture 5

The document outlines various processing methods in operating systems, including batch processing, time-sharing, real-time processing, sequential processing, interrupt-driven processing, and multithreading. Each method is defined with examples and characteristics, highlighting their efficiency and use cases. The document emphasizes the importance of these methods in optimizing resource utilization and improving system performance.

Uploaded by

legendapex166
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views29 pages

OS Lecture 5

The document outlines various processing methods in operating systems, including batch processing, time-sharing, real-time processing, sequential processing, interrupt-driven processing, and multithreading. Each method is defined with examples and characteristics, highlighting their efficiency and use cases. The document emphasizes the importance of these methods in optimizing resource utilization and improving system performance.

Uploaded by

legendapex166
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Operating System Concepts

Lecture-05
by
Kalimullah Khan
Assistant Professor
Lecture Outlines

• Processing Methods
• Batch processing
• Online processing
• Multi-programming
• Multi-processing
• Time-sharing
• Assignment No. 1
Processing Methods

Processing methods refer to the various ways that the system manages and executes tasks or processes.

1. Batch Processing

Definition: Batch processing involves collecting a group of tasks or jobs and processing them all at once
without user interaction.

• Example: Imagine a payroll system that processes employee salaries. Instead of calculating salaries one
by one, the system collects all payroll data over a week and processes it in one go at the end of the
week.
• This batch processing method ensures that all salaries are calculated and disbursed together.
2. Time-Sharing (Multitasking)

Definition: Time-sharing allows multiple users or processes to share the same computer resources
by quickly switching between them. This gives the illusion that each process is running
simultaneously.

• Example: You are using a computer with a word processor, a web browser, and a music player open
at the same time.
• The operating system switches between these applications so quickly that it feels like all are
running simultaneously.
• This is done by allocating short time slices to each application.
3. Real-Time Processing

Definition: Real-time processing involves processing data and producing a response almost instantly,
often within a specific time constraint.

• Example: In a car’s anti-lock braking system (ABS), the sensors detect wheel speed and the system
processes this data in real-time to adjust braking pressure and prevent skidding.
• The response needs to be immediate to ensure safety while driving.
4. Sequential Processing

Definition: Sequential processing executes tasks one after another in a specific order. Each task must
be completed before the next one starts.

• Example: In a simple recipe, you need to follow steps in a specific order:


• first mix ingredients, then bake, and finally let it cool.
• You cannot bake before mixing, and you cannot cool before baking.
• This is sequential processing where each step must be completed in order.
5. Interrupt-Driven Processing

Definition: Interrupt-driven processing involves handling tasks based on priority or immediate need,
using interrupts to signal the operating system that a task needs attention.

• Example: When you receive an email notification while watching a video, the operating system
interrupts the video playback to alert you about the new email.
• After handling the notification, it resumes video playback.
• The notification acts as an interrupt to ensure important tasks are addressed promptly.
6. Multithreading

Definition: Multithreading allows a single process to have multiple threads running concurrently,
each performing different tasks simultaneously. Multi threading allows OS to execute different
threads simultaneousy.

• Example: In a web browser, one thread might handle rendering the webpage, another might
manage user input, and yet another might download files.
• These threads work simultaneously within the same browser process, enhancing efficiency and
responsiveness.
Batch Processing

• Batch processing is a method of processing data where tasks or jobs are collected and executed
together in a single run, without user interaction during the execution.
• This method contrasts with interactive or real-time processing, where tasks are handled
immediately as they are requested.
• Batch processing is efficient for handling large volumes of data or tasks that don’t require
immediate user feedback.
Characteristics of Batch Processing
Job Collection:
Tasks are collected and grouped into a batch. These tasks are often queued up and processed in
sequence.
Scheduled Execution:
Batches are processed at scheduled times or when the system is less busy, rather than interactively
in real time.
No User Interaction:
Once the batch process begins, it runs without requiring further input from the user until it
completes.
Resource Optimization:
Batch processing allows for optimization of resources by scheduling jobs during off-peak hours, thus
maximizing system utilization.
Examples of Batch Processing
Bank Statement Generation
Description:
Banks generate monthly statements for all customers in a batch process. Instead of generating
individual statements on-demand, the bank collects transaction data for all accounts over a month
and processes it together.
Steps:
Data Collection: Transaction data is collected for all accounts over the month.
Batch Job Creation: A batch job is scheduled to process all transactions and generate statements.
Processing: The system processes the transaction data to create account statements.
Output: Statements are mailed to customers or made available online.
Benefits:
• Reduces the load on the system by processing large amounts of data during off-peak hours.
• Standardizes statement generation for all customers.
Advantages of Batch Processing
• Efficiency: Handles large volumes of data or tasks with reduced overhead compared to processing
them individually.
• Resource Utilization: Optimizes the use of system resources by scheduling jobs during off-peak
hours.
• Reduced Human Error: Automates repetitive tasks, minimizing manual intervention and the risk of
errors.
• Consistency: Ensures uniform processing of tasks, leading to standardized results.
Online Processing
• Online processing refers to a system of processing data in real-time or near-real-time, allowing
users to interact with and receive immediate responses from the system.
• In online processing, data is processed as soon as it is entered or received, enabling up-to-date
information and real-time interaction.
• Characteristics of Online Processing
• Real-Time Interaction: Users interact with the system and receive immediate feedback or
responses.
• Continuous Data Processing: Data is processed as soon as it is input or received, ensuring that
information is current and up-to-date.
• Interactive: The system often involves user interaction, allowing users to query, update, and
manage data in real-time.
• Immediate Feedback: Users receive immediate results or outputs based on their inputs or actions.
• Examples of Online Processing
1. Online Banking
• Description:
• Online banking allows users to manage their bank accounts and perform transactions through the
internet in real-time.

• How It Works:
• A user logs into their online banking account and performs tasks such as transferring money
between accounts, paying bills, or checking account balances.
• The system processes these requests immediately, updating account balances and reflecting
changes in real-time.
2. Airline Reservation Systems
• Description:
• Airline reservation systems allow users to book flights and check seat availability in real-time.

• How It Works:
• When a user searches for flights and selects a booking option, the system processes the request,
updates seat availability, and confirms the reservation instantly.
• The user receives an immediate confirmation of their booking and can view real-time updates on
flight status.
• Example:
• You book a flight through an airline's website and receive a booking confirmation email within
seconds. The seat you selected is immediately marked as unavailable to other users
Multiprogramming
• Multiprogramming is a method used in operating systems to increase the efficiency of resource
utilization by allowing multiple programs to be loaded into memory and executed simultaneously.

• Concepts of Multiprogramming
• Multiple Programs in Memory:
• The operating system loads several programs into memory at the same time, so they are ready to
run.
• CPU Utilization:
• While one program is waiting for I/O operations (such as reading from a disk), the CPU can switch
to execute another program that is ready to run.
• Context Switching:
• The operating system manages the transitions between programs, saving the state of the currently
running program and loading the state of the next one to be executed.

• Increased Efficiency:
• By keeping the CPU busy and reducing idle time, multiprogramming improves overall system
efficiency and throughput.
• Examples of Multiprogramming
1. Word Processing and File Download
• Description:
• Suppose you are using a computer to write a document in a word processor while simultaneously
downloading a file from the internet.
• How It Works:
• The word processor and the download manager are loaded into memory.
• While you are typing and saving your document, the system handles the download process in the
background.
• The CPU switches between the word processor and the download manager, allowing both tasks to
proceed concurrently without waiting for one to complete before starting the other.
2. Email Client and Web Browsing
• Description:
• Consider running an email client and a web browser simultaneously on your computer.
• How It Works:
• Both applications are loaded into memory.
• While the email client is checking for new emails or sending messages, the web browser can
render web pages and handle user interactions.
• The operating system ensures that the CPU switches between these applications, allowing you to
read and respond to emails while browsing the web.
• Example:
• You are reading an email in your email client while browsing news websites. Multiprogramming
allows you to switch between your email client and browser without any noticeable delay or
interruption.
Multiprocessing
• Multiprocessing refers to the capability of an operating system (OS) to execute multiple processes
simultaneously.
• This involves the use of multiple CPUs or CPU cores to perform multiple tasks at the same time,
improving overall system performance and responsiveness.
• Key Concepts of Multiprocessing

• Process:
• A process is an independent program in execution, including its code, data, and resources. Each
process runs in its own memory space.

• CPU Cores:
• Modern CPUs have multiple cores, allowing them to perform several tasks concurrently.
Multiprocessing utilizes these cores to run multiple processes simultaneously.
• Concurrency:
• Multiprocessing allows for concurrent execution, meaning multiple processes are making progress
at the same time.

• Parallelism:
• In a multiprocessor system, true parallelism is achieved where multiple processes are executed in
parallel, utilizing different CPUs or cores.
• How Multiprocessing Works in an Operating System
• Process Scheduling:
• The OS uses a scheduler to manage process execution. It assigns CPU time to processes and
decides which process runs at any given time.
• Context Switching:
• The OS performs context switching to switch the CPU's attention between processes. This involves
saving the state of the current process and loading the state of the next process.
• Inter-process Communication (IPC):
• Processes often need to communicate and share data. The OS provides mechanisms like pipes,
message queues, and shared memory for IPC.
• Resource Management:
• The OS manages resources like memory and I/O devices to ensure that multiple processes can run
efficiently without interfering with each other.
• Examples of Multiprocessing
• Operating System Example:
• Scenario:

• Suppose you are running a web browser and a word processor simultaneously on a computer with
a dual-core CPU.
• How It Works:
• The OS schedules the web browser process to run on one core and the word processor process on
the other core.
• Both applications can operate independently and concurrently without affecting each other’s
performance.
• The OS ensures that both processes receive CPU time and that they interact with the system
resources without conflicts.
Time-shairing
• Time-sharing is a computing technique where multiple users or processes share a single computing
resource (such as a CPU) by dividing its time into discrete slices or intervals.
• This approach allows many users or applications to interact with the system simultaneously, giving
the illusion that they each have their own dedicated system.

• Key Concepts of Time-Sharing


• Time Slices (Quanta):
• The CPU’s time is divided into small units called time slices or quanta. Each process or user gets a
time slice to execute, after which the CPU switches to another process.
• Context Switching:
• To switch between processes, the operating system performs context switching, which involves
saving the state of the current process and loading the state of the next process.

• Process Scheduling:
• The OS uses scheduling algorithms to manage which process runs at any given time. Common
algorithms include Round-Robin, Priority Scheduling, and Multilevel Queue Scheduling.

• Interactive Systems:
• Time-sharing systems are typically interactive, meaning they respond to user input in real-time,
making them suitable for systems where users require immediate feedback.
• Example of Time-Sharing
• Scenario:
• Consider a multi-user computer system running a time-sharing operating system. The system has
three users: User A, User B, and User C, each running different applications.
• How Time-Sharing Works:
• Process Allocation:
• The operating system divides the CPU time into 100-millisecond slices (time quanta).
• User A is running a text editor, User B is running a web browser, and User C is running a
spreadsheet application.
• Time Slice Management:
• The OS allocates the first time slice to User A’s text editor. After 100 milliseconds, it saves the state
of the text editor and switches to User B’s web browser for the next time slice.
• This switching continues, giving each user a chance to run their applications.
• Context Switching:
• When switching from User A to User B, the OS performs a context switch:
• Save State: The OS saves the current state of User A’s text editor, including CPU registers, memory
pointers, and other information.
• Load State: The OS loads the saved state of User B’s web browser and resumes its execution.
• Interactive Response:
• As a result, all three users feel as though they are interacting with the system simultaneously. Each
user gets a quick, responsive experience even though the CPU is rapidly switching between
different tasks.
Thank You

You might also like