0% found this document useful (0 votes)
53 views23 pages

Sistemet Operative Operating System Structures: Lënda

The document discusses the internal structures of operating systems. It describes common OS structures like simple, monolithic, layered, microkernel, and modular structures. It notes that most modern OSes use hybrid structures that combine approaches. The document also discusses building and booting an operating system from source code.

Uploaded by

Sara Lohaj
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)
53 views23 pages

Sistemet Operative Operating System Structures: Lënda

The document discusses the internal structures of operating systems. It describes common OS structures like simple, monolithic, layered, microkernel, and modular structures. It notes that most modern OSes use hybrid structures that combine approaches. The document also discusses building and booting an operating system from source code.

Uploaded by

Sara Lohaj
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/ 23

UNIVERSITETI I PRISHTINËS ”HASAN PRISHTINA”

Fakulteti i Inxhinierisë Elektrike dhe Kompjuterike

Lënda: Sistemet Operative

Operating System Structures


Artan Mazrekaj

Prishtinë, 2023

1
Operating System Design and Implementation

▪ Internal structure of different OSes can vary widely.


▪ The first problem in designing a system is to define goals and
specifications.
▪ The design of the system will be affected by choice of hardware and the
type of system: traditional desktop/laptop, mobile, distributed, or real
time.
▪ User goals and System goals:
 User goals – OS should be convenient to use, easy to learn, reliable,

safe, and fast.


 System goals – OS should be easy to design, implement, and maintain,
as well as flexible, reliable, error-free, and efficient.

2
Operating System Design and Implementation (cont.)

▪ Important principle to separate:


Policy: What will be done?
Mechanism: How to do it?

➢ Policies decide what will be done


➢ Mechanisms determine how to do something;

▪ The separation of policy from mechanism is a very important principle, it


allows maximum flexibility if policy decisions are to be changed later.

Specifying and designing an OS is highly creative task of software


engineering!!!

3
Operating System Structure

▪ Once an OS is designed, it must be implemented.


▪ Because OSes are collections of many programs, written by many people
over a long period of time, it is difficult to make general statements about
how they are implemented.
▪ Early OSes were written in assembly language.
▪ Now, most are written in higher-level languages such as C or C++, with
small amounts of the system written in assembly language.

▪ Various ways to structure ones:


❑ Simple structure

❑ Monolithic Structure

❑ Layered approach

❑ Microkernel

❑ Modules
4
Simple Structure

▪ It is the simplest OS Structure and is not well defined; It can only be used for
small and limited systems.
▪ In this structure, the interfaces and levels of functionality are well
separated;
▪ Has no distinction between user and kernel modes, allowing all programs
direct access to the underlying hardware
→ MS-DOS is an example of such OS.

5
Monolithic Structure

▪ A monolithic OS - all functionality is provided in a single static binary file


that runs in a single address space.
▪ The monolithic OS in which the kernel acts as a manager by managing all
things like files, memory, devices, and operational processes of the OS.
▪ Kernel delivers basic services to all other elements of the system.
- It serves as the primary interface between the OS and the hardware.
▪ Although such systems are difficult to modify, their primary benefit is
efficiency.

6
Monolithic Structure (cont.)

• An example is the original UNIX OS, which consists


of two separable parts: kernel and system
programs.
→ The kernel is further separated into a series of
interfaces and device drivers.

Traditional UNIX system structure. Linux system structure.


7
Layered Approach

▪ The OS is divided into a number of layers (levels)


each built on top of lower layers:
- the bottom layer - layer 0 is the hardware;
- the highest - layer N is the user interface.

▪ Functionalities of each layer are isolated, and


abstraction is also available.

▪ The main advantage of the layered approach is


simplicity of construction and debugging.

▪ Although layered software systems have had some


success, this approach is generally not ideal for
A layered approach
designing OSes due to performance problems. system.
→ Layered systems have been successfully used in computer
networks (such as TCP/IP) and web applications.

8
Microkernels

▪ This structure designs the OS by removing all non-essential components


from the kernel and implementing them as user level programs that reside
in separate address spaces.
→ The result is a smaller kernel.

▪ Communication takes place between user modules using message passing.

Advantages:
 Easier to extend a microkernel.

 It allows the OS to be portable between platforms.

 More reliable (less code is running in kernel mode).

 More secure.

Disadvantages:
 Performance overhead of user space to kernel space communication.

 System is complex to be constructed.


9
Microkernel System Structure

Architecture of a typical microkernel.

10
Modules

▪ Modern OS development is object-oriented, with a relatively small core


kernel and a set of modules which can be linked in dynamically.
→ OSes implement Loadable Kernel Modules (LKMs).

▪ Modules are similar to layers in that each subsystem has clearly defined
tasks and interfaces.
▪ This type of design is common in modern implementations of UNIX, such
as Linux, macOS, and Solaris, as well as Windows.

▪ Linux uses LKMs, primarily for supporting device drivers and file systems.

▪ LKMs can be “inserted” into the kernel as the system is started (or
booted) or during run time, such as when a USB device is plugged into a
running machine.

11
Modules (cont.)

▪ The kernel is relatively small in this architecture, similar to microkernels,


but the kernel does not have to implement message passing since
modules are free to contact each other directly.

Solaris loadable modules

12
Hybrid Systems

▪ Most modern OSes are actually not one pure model.


 Hybrid combines multiple approaches to address performance, security,

and usability issues.

 For example, Linux is monolithic, because having the OS in a single


address space provides very efficient performance.
However, it also modular, so that new functionality can be dynamically
added to the kernel.

 Windows is largely monolithic, but it retains some behavior typical of


microkernel systems, including providing support for separate
subsystems that run as user-mode processes.
Windows systems also provide support for dynamically loadable kernel
modules.

13
Hybrid Systems -> macOS and iOS

▪ Apple’s macOS is designed to run primarily on desktop and laptop computer


systems.
▪ iOS is a mobile OS designed for the iPhone smartphone and iPad tablet
computer.
▪ The general architecture of these two systems.

User experience layer:


- macOS uses the Aqua user interface,
- iOS uses the Springboard user interface
Application frameworks layer
- This layer includes the Cocoa and Cocoa Touch frameworks,
which provide an API for the Objective-C and Swift
programming languages.
Core frameworks
- This layer defines frameworks that support graphics and media
including, Quicktime and OpenGL.
Architecture of Apple’s macOS
Kernel environment
and iOS operating systems.
- This environment, also known as Darwin, includes the Mach
microkernel and the BSD UNIX kernel.
14
Hybrid Systems -> Android

▪ The Android OS was designed by the Open Handset Alliance (led primarily
by Google) and was developed for Android smartphones and tablet
computers.
▪ Android runs on a variety of mobile platforms and is open sourced.
▪ Android is similar to iOS in that it is a layered stack of software that
provides a rich set of frameworks supporting graphics, audio, and
hardware features.
▪ Software designers for Android devices, develop applications in the Java
language, but they do not generally use the standard Java API.
→ Google has designed a separate Android API for Java development.

15
Android Architecture

Architecture of Google’s Android


16
Building and Booting an Operating System

▪ OSes generally designed to run on a class of systems with variety of


peripherals.

▪ Commonly, OS already installed on purchased computer:


 But can build and install some other OSes.

 If you are generating (or building) an OS from scratch, you must follow
these steps:
✓ Write the OS source code,

✓ Configure the OS for the system on which it will run,

✓ Compile the OS,

✓ Install the OS,

✓ Boot the computer and its new OS.


17
System Boot

▪ When power initialized on system, execution starts at a fixed memory


location.

▪ On most systems, the boot process proceeds as follows:


1. A small piece of code known as the bootstrap program or boot loader -
BIOS (stored in ROM or EEPROM) locates the kernel.
2. The kernel is loaded into memory and started.
3. The kernel initializes hardware.
4. The root file system is mounted.

 Modern systems replace BIOS with Unified Extensible Firmware Interface


(UEFI). UEFI has several advantages over BIOS, including better support for 64-
bit systems and larger disks.
▪ GRUB is an open-source bootstrap program for Linux and UNIX systems.

18
Operating System Debugging

▪ Debugging is finding and fixing errors, or bugs.


▪ OS generate log files containing error information.
▪ Failure of an application can generate core dump file capturing memory of
the process.
▪ OS failure can generate crash dump file containing kernel memory.
▪ Beyond crashes, performance tuning can optimize system performance.
 Sometimes using trace listings of activities, recorded for analysis.

 Profiling is periodic sampling of instruction pointer to look for


statistical trends.

Kernighan’s Law: “Debugging is twice as hard as writing the code in the


first place. Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”
19
Performance Tuning

▪ Improve performance by removing bottlenecks.


▪ OS must provide means of computing and displaying measures of system
behavior.
▪ For example, “top” program or Windows Task Manager

The Windows 10 task manager 20


Tracing

▪ Collects data for a specific event, such as steps involved in a system call
invocation.

▪ Tools include:
strace – trace system calls invoked by a process
gdb – source-level debugger
perf – collection of Linux performance tools
tcpdump – collects network packets

21
BCC

▪ Debugging interactions between user-level and kernel code nearly


impossible without toolset that understands both and an instrument their
actions.

▪ BCC (BPF Compiler Collection) is a rich toolkit providing tracing features


for Linux.
→ See also the original Dtrace

▪ For example, disksnoop.py traces disk I/O activity

22
Pyetje dhe Diskutime ?

23

You might also like