Lecture 8 Operating System Design by FQ
Lecture 8 Operating System Design by FQ
Platform Technology
Lecture # 8
Operating System Design
1
THE JOURNEY
2
OUTLINE: OPERATING SYSTEM
DESIGN
• OS DESIGN
• OS IMPLEMENTAION
• OS STRUCTURE
• SYSTEM BOOT
• OS ENVIRONMENT
• OS TASKS
• OS EFFICIENCY
• KERNAL
• MICROKERNAL
• MONOLITHIC KERNAL
• MICROKERNEL vs MONOLITHIC
3
OS DESIGN
DESIGN GOALS:
• At the highest level, system design
is dominated by the choice of
hardware and system type.
• Beyond this level, the requirements
can be divided into two groups: user
goals, and system goals.
• User goals include convenience,
reliability, security, and speed.
• System goals include ease of
design, implementation,
maintenance, flexibility, and
efficiency.
4
OS IMPLEMENTATION
5
OS STRUCTURE
6
SYSTEM BOOT
• Booting the system is done by loading the kernel into main memory, and starting its
execution.
• The CPU is given a reset event, and the instruction register is loaded with a predefined
memory location, where execution starts.
o The initial bootstrap program is found in the BIOS read-only memory.
7
OS ENVIRONMENT
o The loader program loads and starts the operating system.
o When the Operating system starts, it sets up needed data structures in
memory, sets several registers in the CPU, and then creates and starts the
first user level program.
o From this point, the operating system only runs in response to interrupts.
8
OS TASKS
1. Program Execution
• An OS has to be able to load a program into memory and run that program.
• Also, this program needs to be able to end execution, whether normally or
abnormally.
2. I/O Operations
• A running program may require I/O in the form of a file or an output device.
• Due to a security or efficiency need, users often do not control I/O, so the OS
must provide the means for I/O.
3. File-system manipulation
• Programs need to able to read and write to files, also delete, rename, and
remove them.
• It is also necessary that files have permission functionality to provide additional
security.
4. Communication
• Often times one process must communication with another process.
• Communication may be between the processes of a single computer, or
computers connected via a network.
• Communication may be implemented via shared memory or through message
passing.
9
OS EFFICIENCY FUNCTIONS
1. Resource Allocation
• Multiple users or jobs require that resources be allocated to each
one.
• Some resources have a special allocation code, while others may
have more general request and release code.
10
KERNAL
• Kernel is the core part of an operating system; it manages the system resources.
• Kernel is like a bridge between application and hardware of the computer.
• The Kernel can be classified further into two categories: Microkernel and
Monolithic Kernel.
• Microkernel is the one in which user services and kernel services are kept in
separate address space.
• However, in Monolithic kernel user services and kernel services both are kept in
the same address space.
11
MICROKERNELS
• In microkernels, the kernel is broken down into separate processes, known as
servers.
• Some of the servers run in kernel mode and some run in user mode. All servers
are kept separate and run in different address spaces.
• The user services are kept in user address space, and kernel services are
kept under kernel address space.
• This reduces the size of the kernel and further reduces the size of operating
system.
• Services like IPC(Inter process Communication), basic scheduler, memory
handling, basic I/O primitives etc., are put into the kernel mode. Others are
maintained as server processes in User Space.
12
MICROKERNELS Cont..
• The communication between the client
program/application and services
running in user mode is established
through message passing. They never
interact directly. However, this reduces
the speed of execution of
microkernel.
13
MICROKERNELS Cont..
Advantages
1- Crash Resistant
2- Smaller Size
3- Easier to extend a microkernel
4- Easier to port the operating system to new architectures
5- More reliable
6- More secure
Disadvantages
• Slower Processing due to Additional Message Passing
14
MONOLITHIC KERNEL
• The monolithic kernel manages the
system resources between application
and hardware of the system.
• But unlike microkernel, the user services
and kernel services are implemented
under same address space.
• The entire operating system runs as a
single program in kernel mode.
• This increases the size of the kernel
further increases the size of operating
system.
• All the parts of a kernel like the Scheduler,
File System, Memory Management,
Networking Stacks, Device Drivers, etc.,
are maintained in one unit within the kernel
in Monolithic Kernel.
15
MONOLITHIC KERNAL Cont..
• The monolithic kernel provides CPU
scheduling, memory management, file
management and other operating system
functions through system calls.
16
MONOLITHIC KERNAL Cont..
Advantages
1. Faster processing
2. OS is easy to design and implement.
3. Difficult to add new functionalities.
4. Less code when compared to microkernel
5. Execution speed is high.
Disadvantages
• Crash Insecure
• Porting Inflexibility
• Kernel Size explosion
Examples
• MS-DOS
• Unix
• Linux
• Windows XP
17
MICROKERNEL vs MONOLITHIC
18
MICROKERNEL vs MONOLITHIC
COMPARISON TABLE
BASIS FOR
MICROKERNEL MONOLITHIC KERNEL
COMPARISON
In microkernel user services and In monolithic kernel, both user services and
Basic kernel, services are kept in kernel services are kept in the same
separate address space. address space.
Size Microkernel are smaller in size. Monolithic kernel is larger than microkernel.
19
CONCLUSION:
• Monolithic kernels are usually faster than microkernels. The first
microkernel match was 50% slower than most monolithic kernels,
while later ones like L4 were only 2% or 4% slower than the monolithic
designs.
• Monolithic kernels are big in size, while microkernels are small in
size - they usually fit into the processor's L1 cache (first generation
microkernels).
• Since monolithic kernel’s device drivers reside in the kernel mode,
monolithic kernels are less secure than microkernels, and failures
(exceptions) in the drivers may lead to crashes.
• Microkernels are more secure than monolithic kernels, hence more
often used in military devices.
20
THANK
YOU
21