Kernel Shell
Kernel Shell
File
Process & Resource Manager
Manager
Memory Device
Manager Manager
Hardware
OS Organization
OS Kernel
Hardware
• The portion of code that performs these core services is
called the "Kernel” of the operating system.
• The kernel of an operating system is something you will
never see (hidden from the user).
• It basically enables your programs to execute. It handles
events generated by hardware (called interrupts) and
software (called system calls), and manages access to
resources.
• The hardware-event handlers (interrupt handlers) will, for
instance, get the number of the key you just pressed and
convert it to the corresponding character stored in a
buffer so some program can retrieve it.
Interrupt Handler
Interrupt Handler
• The system calls are initiated by user-level programs, for
opening files, starting other programs, etc. Each system
call handler will have to check whether the arguments
passed are valid, and then perform the internal operation
to complete the request.
• Most user programs do not directly issue system calls,
but instead use a standard library which does the ugly
job of formatting arguments as required by the kernel
and generating the system call. (For example, the C
function fopen() eventually calls a kernel function that
actually opens the file.)
• The kernel usually defines a few abstractions like files,
processes, sockets, directories, etc. which correspond to
an internal state it remembers about last operations, so
that a program may issue a session of operation more
efficiently.
• Kernel design ideologies include monolithic kernel,
microkernel and exokernel. Among commercial systems,
such as Unix and Windows, the monolithic approach is
predominant, with a few noted exceptions (eg, QNX).
The microkernel approach is more popular among
research OS’s.
Trap – software interrupts
• The mode bit is set user mode
User
trap hardware (aka supervisor call) UP space
instruction. SP
• The trap instruction is not a System
privileged instruction. space
• Branches to a fixed location in the
system space
• Only the OS routines will be Mode
loaded in the system space which S Trap table
is explicitly protected because no trap
user program can load its own
code into it.
• Requires a relatively long time to Trusted
Code
execute compared to normal
function call. User Supervisor