0% found this document useful (0 votes)
22 views22 pages

Lect 3

The document outlines key components and functionalities of operating systems, including time-sharing systems, interrupt handling, and hardware protection mechanisms. It explains dual-mode operation for resource sharing, I/O and memory protection, and the role of system calls in managing user access to kernel resources. Additionally, it details the services provided by operating systems for user and system efficiency, along with the execution process of system calls.
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)
22 views22 pages

Lect 3

The document outlines key components and functionalities of operating systems, including time-sharing systems, interrupt handling, and hardware protection mechanisms. It explains dual-mode operation for resource sharing, I/O and memory protection, and the role of system calls in managing user access to kernel resources. Additionally, it details the services provided by operating systems for user and system efficiency, along with the execution process of system calls.
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/ 22

Operating System

By Umer Tanveer
Time Sharing System

 An interactive system with multiprogramming


 A job is swapped in and out of memory to the disk if
needed.
 On-line file system must be available for users to
access data and code.
Interrupt Handling System

 Interrupt transfers control to the interrupt service


routine, generally, through the interrupt vector,
which contains addresses of all the interrupt 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.
Interrupt Handling System

 Incoming interrupts are disabled while another


interrupt is being processed to prevent lost
interrupts.
 An operating system is interrupt driven.
Hardware Protection

 Dual-Mode Operation
 I/O Protection
 Memory Protection
 CPU Protection
Dual Mode Operations

 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.
Dual Mode Operations

 Mode bit added to computer hardware to indicate


the current mode: monitor (0) or user (1).
 When an interrupt or fault occurs hardware switches
to monitor mode.
Interrupt/fault

monitor user
set user mode
I/O Protection

 All I/O instructions are privileged instructions.


 Must ensure that a user program could never gain
control of the computer in monitor mode (i.e., a user
program that, as part of its execution, stores a new
address in the interrupt vector).
Use of A System Call to Perform I/O
Memory Protection

 Must provide memory protection outside the


address space of a process.
 In order to have memory protection, add two
registers that determine the range of legal
addresses a program may access:
 Base register – holds the smallest legal physical
memory address.
 Limit register – contains the size of the range
 Memory outside the defined range is protected.
Use of Base and Limit Register
Hardware Support
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.
 Timer commonly used to implement time sharing.
 Time also used to compute the current time.
 Load-timer is a privileged instruction.
OS Components

 Process management
 Main memory management
 Secondary storage management
 I/O system management
 File management
 Protection system
 Networking
 Command-line interpreter (shells)
Operating System Services

Services for user and users of programs:


 Program execution
 I/O Operations
 File System Manipulation
 Communications between processes/users
 Error detection and handling
Operating System Services …

Services for efficient system operation:


 Resource management
 Accounting
 Protection
Entry Points In Kernal

 Trap
 System Call
 Signal
 Interrupt
OS Kernal

User
Applications
OS/ API / AUI
OS Kernal
Computer Hardware
SYSTEM CALLS

 Userprocesses must not be given open


access to the kernel code
 Thesystem call interface layer contains
entry point in the kernel code
 Anyuser or application request that
involves access to any system resource
must be handled by the kernel code
SYSTEM CALL EXECUTION

 The user program makes a call to a library function.


 Library routine puts appropriate parameters at a
well-known place (registers, stack, or a table in
memory).
 The trap instruction is executed to change mode
from user to kernel.
 Control goes to operating system.
 Operating system determines which system call is
to be carried out.
Semantics of System Call Execution

 Kernel indexes the dispatch table, which contains
pointers to service routines for system calls.
 Service routine is executed and return parameter or
error code placed at well-known places (usually a
CPU register).
 Control given back to user program.
 Library function executes the instruction following
trap.
How It Works

You might also like