0% found this document useful (0 votes)
7 views4 pages

Interrupts vs Polling in Operating Systems

The document discusses the differences between interrupts and polling as techniques for handling input/output operations in computer systems. Interrupts are asynchronous and more efficient, allowing the CPU to handle events immediately, while polling is synchronous and can waste CPU cycles by repeatedly checking devices. Examples of operating systems using these techniques include Windows, Linux, and macOS for interrupts, and early UNIX versions and some embedded systems for polling.

Uploaded by

hamzaaka007
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)
7 views4 pages

Interrupts vs Polling in Operating Systems

The document discusses the differences between interrupts and polling as techniques for handling input/output operations in computer systems. Interrupts are asynchronous and more efficient, allowing the CPU to handle events immediately, while polling is synchronous and can waste CPU cycles by repeatedly checking devices. Examples of operating systems using these techniques include Windows, Linux, and macOS for interrupts, and early UNIX versions and some embedded systems for polling.

Uploaded by

hamzaaka007
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

Presented By:

NAME: Hamza Saeed


Roll no : 048
CLASS: ADP–CS
SECTION: 21a
Assingment: 01

SUBJECT: Operatin systems


SUBMITTED TO: Prof Najda Malik
Q: What is the diference between Interrupt and Poling? Which one is beter
and give examples of diferent operatng systems using these techniques.

Interrupts and polling are two diferent techniques used by computer systems to
handle input/output (I/O) operatonss

Interrupts are a method of asynchronous I/O handlings An interrupt is a signal


generated by a device, such as a keyboard or mouse, to the CPU to notfy it that
an event has occurred that requires atentons When the CPU receives an
interrupt signal, it stops executng the current instructon and handles the
interrupt by calling an interrupt handler routne that is specifc to the device
generatng the interrupts This routne then performs the necessary I/O operaton
and returns control back to the CPUs Interrupts are hardware signals that are
sent to the processor by devices to request atenton or services When an
interrupt occurs, the processor interrupts the current task it is performing, saves
its current state, and executes an interrupt handler to service the device that
generated the interrupts Interrupts are used to handle events that require
immediate atenton, such as keyboard or mouse input, disk I/O, or network
traffics Interrupts are generally faster and more efficient than polling because the
processor does not waste tme repeatedly checking for events that may not have
occurred yets

Polling, on the other hand, is a method of synchronous I/O handlings With polling,
the CPU repeatedly checks a device for new data or events by sending status
queries to the devices If the device has new data or an event has occurred, it
sends a response back to the CPUs This process contnues untl the device is ready
to send data or an event occurss It is a technique where the operatng system
periodically checks each device to see if it has any pending I/O requestss Polling
involves repeatedly checking a device for new data or input, regardless of
whether or not it is actually ready to send datas This can result in wasted CPU
cycles, as the processor may repeatedly check a device even if there is no new
data availables Polling can also introduce latency or delay, as the processor may
not be able to immediately respond to requestss
In general, interrupts are considered more efficient and faster than polling, as
they allow the CPU to perform other tasks while waitng for an I/O operaton to
completes Polling, on the other hand, requires the CPU to contnually check the
device for new data, which can slow down the overall performance of the
systems

In terms of which technique is beter, it depends on the specifc use case and the
characteristcs of the devices and the operatng system being useds Interrupts are
generally preferred for handling events that require immediate atenton, such as
user input, because they are more responsive and efficients However, polling may
be more appropriate for devices that generate data at a regular, predictable rate,
as it can reduce the overhead of handling interruptss

• Examples of operatng systems that use interrupts include Windows, Linux,


and macOSs These operatng systems rely heavily on interrupts for
handling I/O operatons from various devices, such as keyboards, mice, and
network adapterss

• Examples of operatng systems that use polling include early versions of


UNIX and some embedded systemss In these systems, polling may be used
for low-level I/O operatons, such as reading from or writng to memory-
mapped devicess However, for high-level I/O operatons, interrupts are
generally preferred for their efficiency and speed

• Examples of operatng systems using these techniques include:

Windows: Windows uses a combinaton of interrupts and polling for I/O


operatonss For example, Windows uses interrupt handlers to handle input from
the keyboard or mouse, while it uses polling to check for new data from network
devicess

Linux: Linux also uses a combinaton of interrupts and polling for I/O operatonss
Linux generally relies more on interrupts than polling, as it is designed to be more
responsive and efficients However, Linux can use polling for certain devices, such
as USB devices or some network interfacess

macOS: macOS primarily uses interrupts for I/O operatons, but can also use
polling for certain devicess For example, macOS uses polling for Bluetooth
devices, as it can reduce power consumptons

Overall, the choice between interrupts and polling depends on the specifc use
case and the characteristcs of the devices and operatng system being used

You might also like