0% found this document useful (0 votes)
31 views

OS - Lecture 02 Operating System

The document discusses various aspects of operating system protection mechanisms. It describes interrupts, traps, and signals and how they are used to transfer control from user processes to the operating system. It then discusses hardware protection mechanisms for I/O, memory, and CPU resources. Specifically, it outlines how dual mode operation, privileged instructions, memory address registers, and timers are used to prevent user processes from directly accessing these hardware resources and maintain operating system control.

Uploaded by

Zeeshan Ahmad
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)
31 views

OS - Lecture 02 Operating System

The document discusses various aspects of operating system protection mechanisms. It describes interrupts, traps, and signals and how they are used to transfer control from user processes to the operating system. It then discusses hardware protection mechanisms for I/O, memory, and CPU resources. Specifically, it outlines how dual mode operation, privileged instructions, memory address registers, and timers are used to prevent user processes from directly accessing these hardware resources and maintain operating system control.

Uploaded by

Zeeshan Ahmad
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
You are on page 1/ 13

Operating Systems

CC-311 / CC-217

Department of Information Technology, Faculty of Computing and IT, University of the Punjab, Gujranwala Campus
Agenda for Today
• Interrupts
• Traps
• Signal
• Hardware (I/O, Memory, and CPU) Protection
Interrupts
 An interrupt is a signal generated by a hardware device
(usually an I/O device) to get CPU’s attention.
 Interrupt transfers control to the interrupt service routine
(ISR), generally through the interrupt vector table, which
contains the addresses of all the service routines.
 Interrupt architecture must save the address of the
instruction after the interrupted instruction and the CPU state
so that execution of the interrupted process may continue
after the interrupt has been serviced.
 Incoming interrupts are disabled while another interrupt is
being processed to prevent a lost interrupt.
Traps
 A trap (or an exception) is a software-generated interrupt
caused either by an error or by a user request for an
operating system service.
Signals
 A signal is an event generated to get attention of a process.
 The signal generated in this case is called SIGINT (Interrupt
signal).
 Three actions are possible on a signal:
 Kernel-defined default action
 Process can intercept the signal and ignore it
 Process can intercept the signal and take a programmer-
defined action
Hardware Protection
 Dual Mode Protection
 I/O Protection
 Memory Protection
 CPU Protection
Dual Mode Operation
 Sharing system resources requires operating system to
ensure that an incorrect program cannot cause other
programs to execute incorrectly.
 Provide hardware support to differentiate between at least
two modes of operations.
 User mode - execution done on behalf of a user.
 Monitor mode (also kernel mode or system mode) -
execution done on behalf of operating system.
 Mode bit added to computer hardware to indicate the current
mode: monitor (0) or user (1).
I/O Protection
 All I/O instructions are privileged instruction.
 When a CPU is executing in a user mode, it is not allowed to
execute these privileged instructions. If it try to do it, a trap
will be generated and program will be terminated.
 This is because we don’t want a user process to hold device
directly.
 So, I/O will be done using system call.
Memory Protection
 Memory Address Space
 The area where the process is loaded into the main
memory is called memory address space
 By implementing memory protection, we want to make sure
that no process can access memory space outside its
Process Address Space
 This is because we don’t want a user process to hold device
directly.
 To implement memory protection, usually two registers are
used:
 Base Register - holds the smallest legal physical memory
address.
 Limit Register - contains the size of the process.
Memory Protection
Memory Protection
CPU Protection
 Timer – interrupts computer after specified period to ensure
operating system maintains control.
 Timer is decremented every clock tick.
 When timer reaches the value 0, an interrupt occurs.
 This is because we don’t want a user process to hold device
directly.
 Timer commonly used to implement time sharing.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy