Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views12 pages

3rd Lecture OS

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

Operating System

CS(407)
Lecture 3
Instructor

Sibgha Zia
Department of Computer Science
UAF Sub Campus Burewala
06/10/2021
Interrupts (stop the continuous progress of activity)
“Interrupts are signals sent to the CPU by external devices, normally I/O devices.”
They tell the CPU to stop its current activities and execute the appropriate part of the
operating system.
“Interrupt is a hardware generated change of flow within the system”

Common functions of interrupts:


i. When an interrupt occurs, the control is transferred to the interrupt service routine.
ii. The interrupt service routine is generally accessed through an interrupt vector.
iii. The interrupt architecture must save the address of instruction that has been
interrupted(The program counter)
iv. Hardware Interrupts are generated by hardware devices to signal that they need
some attention from the OS. They may have just received some data (e.g.,
keystrokes on the keyboard or an data on the Ethernet card.

v. Trap is a software generated interrupt that is either caused by an error or by a user


request for an I/O operation.

vi. An OS is interrupt driven. This means that if there is no interrupt ,then the system
will be idle.

vii. The operating system must determine which type of interrupt has occurred. This can
be done by polling or by using vectored interrupt system.(direction)

Polling is a systematic checking of each device to see if it was the device responsible
for generating the interrupt. If the operating system has vectored interrupt system,
then the identity of the device and the type of interrupt will be easily identifiable
without checking each device.
 An interrupt handler deal with the cause of the interrupts.

 It is a kind of special block of code when interrupt occur control directly jumps to the
interrupt handler and execute that code which is placed in the handler.
Classes of Interrupts
 Supervisor call interrupts SVC: interrupts are initiated by a running process that
executes SVA )

 I/O interrupts :Are initiated by I/O hardware.

 External interrupts: Are caused by different events.

 Restart interrupts: Are occur when the restart button of console is pressed

 Program check interrupts: caused by different problems during execution of


machine language instruction.

 Machine check interrupts: are caused by the hardware that does not function
properly.
Kernel
 The kernel provides the most basic interface between the computer itself and the rest of
operating system.
 The kernel is responsible for the management of central processor.

 The kernel includes the dispatcher to allocate the central processor, to determine
 the cause of an interrupt and initiate its processing,
 some provision for communication among the various system
 user task currently active in system.
Structure of kernel based operating system

hardware

kernel

Operating system
Functions of kernel
Kernel is the core of Operating system.
The main function are:
i. Provides mechanism for creation and deletion of process.
ii. Provide CPU scheduling ,memory management and device management for these
processes.
iii. Provide synchronization tools so processes can synchronize their action.
iv. Provide a communication tool so process can communicate with each other.

 Kernel security and protection


The kernel also protects the hardware. If there is no protection, any program will be
able to carry out any task on the computer, including crashing your computer,
corrupting data, etc.
What are the types of Kernel
1) Monolithic Kernel: the OS and Kernel both run in the same memory space and suitable
where security is not a significant concern. It results in faster access, but if there is a bug
in the device driver, the entire system crashes.

2) Microkernel: Its a stripped-down version of Monolithic Kernel where the Kernel itself
can do most of the job done, and there is no need of an extra GUI. They should be used
where security and the crashing system isn’t or will not happen.

3) Hybrid Kernel: This Kernel is what we see most. Windows, Apple’s macOS. They are a
mix of Monolithic Kernel and Microkernel. It moves out drivers but keeps system
services inside the Kernel – similar to how drivers are loaded when Windows Starts the
bootup process.

4) Nano Kernel: If you need to have a kernel, but its majority of function is set up outside,
then this comes into the picture.

5) Exo Kernel: This kernel only offers process protection and resource handling. However
it is mostly used when you are testing out an in house project, and you upgrade to a
better Kernel type.
System Calls
 Provide an interface between a user program and operating system. It is a
programmatic method in which a computer program requests a service from the
kernel of the OS.
 System call offers the services of the operating system to the user programs via
API (Application Programming Interface).
 Many system calls are written in Assembly language and are machine dependent.
Why do you need System Calls in OS?

Following are situations which need system calls in OS:


 Reading and writing from files demand system calls.
 If a file system wants to create or delete files, system calls are required.
 System calls are used for the creation and management of new processes.
 Network connections need system calls for sending and receiving packets.
 Access to hardware devices like scanner, printer, need a system call.
Main Types of System Calls
 Process Control : e.g end, load, execute, create, terminate process,
 File Management : e.g create file,delete file,open file,close,read,write etc
 Device Management: e.g request, release, get device etc.
 Information Maintenance: e.g set time or date, get system data etc.
 Communications: e.g create,delete communication connection, send and receive
messages etc.

You might also like