Seminar
on
MICROKERNEL
BY
[Link]
(ME IT 9114)
SCTR’s PUNE INSTITUTE OF COMPUTER TECHNOLOGY,
PUNE
Computer has 2 modes of operation…….
• Kernel Mode
• User Mode
• The OS is the most fundamental piece of software & runs in
kernel mode(supervisor mode).
• In this mode, it has complete access to all the h/w and execute
any instruction the machine is capable of.
• Everything running in Kernel Mode is clearly a part of OS ,but
some program running outside it are arguably also part of it or
closely associated with it.
• Distinction between OS mode and user mode is that if a user
does not like a particular e-mail reader , he is free to get
different one or write his own.
• Whereas he is not free to write his own clock interrupt handler,
a part of OS & protected by h/w against attempts by user to
modify it.
• There are however programs which run in user mode but help
the OS or perform privileged functions.
Ex. Changing Password program- not part of OS and not runs in
kernel mode.
SYSTEM STRUCTURE
• Design and Implementation of OS not “solvable”, but
some approaches have proven successful
• Internal structure of different Operating Systems can
vary widely
• Start by defining goals and specifications
• Affected by choice of hardware, type of system
• User goals and System goals
– User goals – operating system should be convenient to
use, easy to learn, reliable, safe, and fast
– System goals – operating system should be easy to
design, implement, and maintain, as well as flexible,
reliable, error-free, and efficient
• Approach is to partition the task into small components rather
than a monolithic structure.
• Each of these modules should be well-defined portions of the
system , with proper inputs, outputs and functions.
• All the modules (process , main memory, file, i/o system,
secondary storage, networking , command-interpreter
management ) are interconnected and melded into a kernel.
SIMPLE STRUCTURE
• MS- DOS an example of such system, originally
designed and implemented to provide most
functionality in least space(limited h/w).
• Not divided in modules
• It has some structure but its interfaces and
functionalities not well separated.
UNIX
• OS initially limited by h/w functionality.
• 2 separable parts
- System Programs
- Kernel
• Consists of everything below the system-call interface
and above the physical hardware
• Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level
MONOLITHIC STRUCTURE
• In this approach the entire operating system runs as a
single program in kernel mode.
• The operating system is written as a collection of
procedures, linked together into a single large
executable binary program.
• An unwieldy and difficult to understand system.
The main disadvantages of monolithic structures
are:
The dependencies between system
components - a bug in a device driver might
crash the entire system.
Large kernels can become very difficult to
maintain.
LAYERED APPROACH
• It’s a way of Modularization of system, in which OS
is broken into number of layers or levels.
• Each built on top of lower layers, bottom layer(layer
0) is the h/w & the highest layer (layer N) is user
interface.
• OS layer is an implementation of an abstract object
that is encapsulation of data & of the operations that
manipulate that data.
• It contains data structures and routines that can be
invoked by higher level layers & it can invoke
operations on lower layer.
Advantages:
Modularity
Simplifies debugging and system verification.
Ease in error solving.
Each layer hides the existence of certain data structures,
operations and h/w from higher layers.
Difficulties:
Careful definition of each layer.
They tend to be less efficient than other type(due to overhead
added by each layer to system call).
THE system built at the Technische Hogeschool Eindhoven in the
Netherlands by E. W. Dijkstra (1968) and his students
MICROKERNELS
• With layered approach the designers have a choice
where to draw the kernel-user boundary.
• Traditionally all the layers were in the kernel.
• In fact, a strong base can be made for putting as little
as possible in kernel mode because bugs in kernel can
bring down the system instantly.
• In contrast user processes can be set up to have less
power so that a bug there may not be fatal.
• The basic idea behind the microkernel design is to
achieve high reliability by splitting the OS up into
smaller but well defined modules , only one mode
THE MICROKERNEL runs in the kernel mode& the
rest run as relatively less power ordinary user
processes.
• Another function is to provide communication facility
between client program and various services running.
BENEFITS:
Ease of extending the OS
All new services added to user space, thus no need to
modify kernel , and when needed changes are few
because microkernel is smaller kernel.
BENEFITS:
OS is more easier to port from one h/w design to
another.
More security & reliability since most services are
running as user rather than kernel processes.
If a service fails the rest of OS remains untouched,
which is in contrast with monolithic system.
• Tru64 UNIX(formerly Digital UNIX) provides a
UNIX interface to the user , uses microkernel ,
implemented with Mach kernel.(which maps UNIX
system calls into messages to appropriate user-level
servies.)
• The Apple MacOS Server OS is also based on Mach
Kernel.
• QNX is RTOS based on Microkernel design,
providing services for message passing and process
scheduling.
MINIX 3
• MINIX 3 is a POSIX conformant, open source
microkernel system freely available .
• It is only about a 3200 lines of C & 800 lines of
assembler for very low level functions such as
catching interrupts & switching process.
• The C code manages & schedules processes, handles
inter process communication & offers a set of about
35 kernel calls to allow the rest of OS to do its work.
• These calls does: looking handlers for interrupts,
moving data between address spaces , installing new
memory maps for newly created processes.
MINIX 3 Structure
• Lowest layer in user mode: Device Drivers
Do not have physical access to i/o port space & cannot issue
i/o command directly.
• Above lowest layer : Server
All servers like file server which manages file system i.e.
create , destroy and manages process.
One interesting server is “reincarnation server” which
checks if other server & drivers are working properly and
if found faulty corrects it…so a self-healing system.
• User Program obtain OS services by sending short
messages to the servers asking for the POSIX system
calls
• Each layer has exactly the power do its work and nothing
more , limiting the damage a baggy component can do.
• Idea of Minimal Kernel is to put the mechanism for
doing something in the kernel but not the policy.
• Ex. Scheduling Problem
Mechanism: look for highest priority process & run it.
Policy: assigning priorities to process , can be done by
user mode process.
Thus policy and mechanism can be decoupled and
kernel can be made smaller.
“Microkernel (also known as μ-kernel or Samuel
kernel) is the near-minimum amount of software that
can provide the mechanisms needed to implement an
operating system (OS)”