0% found this document useful (0 votes)
50 views21 pages

Lecture 8 Operating System Design by FQ

The document provides an overview of operating system design. It discusses key concepts like OS design goals, implementation in higher-level languages, structure with separate user and kernel modes, the boot process, tasks performed by the OS like resource allocation and protection, and different kernel types. The main kernel types discussed are microkernels, which separate kernel and user services into different address spaces, and monolithic kernels, which combine them in a single address space. Microkernels offer benefits like crash resistance but have slower performance, while monolithic kernels are faster but less secure.

Uploaded by

aina syaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views21 pages

Lecture 8 Operating System Design by FQ

The document provides an overview of operating system design. It discusses key concepts like OS design goals, implementation in higher-level languages, structure with separate user and kernel modes, the boot process, tasks performed by the OS like resource allocation and protection, and different kernel types. The main kernel types discussed are microkernels, which separate kernel and user services into different address spaces, and monolithic kernels, which combine them in a single address space. Microkernels offer benefits like crash resistance but have slower performance, while monolithic kernels are faster but less secure.

Uploaded by

aina syaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

* TM2033

Platform Technology

Lecture # 8
Operating System Design

By Dr. Faizan Qamar

1
THE JOURNEY

1 Computer 2 CPU, Memory 3 ISA 4 Computer


System System and
Performance
Input Output

5 Operating 6 Process 7 Memory and File 8 Operating


System Management Management System Design

9 Mobile Computing 10 Parallel Computing


Platform

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

• At first, operating systems were written in assembly, but now C/C++ is


the language commonly used.
• Small blocks of assembly code are still needed, especially related to
some low level I/O functions in device drivers, turning interrupts on
and off and the Test and Set Instruction for Synchronization Facilities.
• Using higher level languages allows the code to be written faster. It
also makes the OS much easier to port to different hardware
platforms.

5
OS STRUCTURE

• Operating systems such as MS-DOS and the original UNIX did


not have well-defined structures.
• There was no CPU Execution Mode (user and kernel), and so
errors in applications could cause the whole system to crash.

In MS-DOS, applications may


bypass the operating system.

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.

2. Protection and Security


• It should not be possible for one process to interfere with other
processes or the OS itself.
• This means that all access to system resources is controlled.
• Protecting the system from outside threats is done through
authenticating users, and to defending external I/O devices.
• Log files can help detect and track attempts of outside infiltration.

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.

• In a microkernel, the user services are


isolated from kernel services so if any
user mode fails it does not affect the
kernel mode and hence Operating
system remain unaffected.

• The microkernel is easily extendable. If


the new services are to be added, they
are added to user mode and hence, the
kernel mode do not require any
modification.

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

Examples •Mac OS X and Windows NT.

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.

• As user services and kernel services both


reside in same address space, this results in
the fast executing operating system.

• The drawbacks of the monolithic kernel is if


any one service fails entire system is
crashed.

• If a new service is to be added in monolithic


kernel, the entire operating system is to be
modified.

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.

Execution Slow execution. Fast execution.


The microkernel is easily
Extendible The monolithic kernel is hard to extend.
extendible.
If a service crashes, it does effect If a service crashes, the whole system
Security
on working of microkernel. crashes in monolithic kernel.
To write a microkernel, more code To write a monolithic kernel, less code is
Code
is required. required.
QNX, Symbian, L4Linux, Linux, BSDs (FreeBSD, OpenBSD,
Singularity, K42, Mac OS X, NetBSD), Microsoft Windows (95,98,Me),
Example
Integrity, PikeOS, HURD, Minix, Solaris, OS-9, AIX, HP-UX, DOS,
and Coyotos. OpenVMS, XTS-400 etc.

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

You might also like