SlideShare a Scribd company logo
2.1
OPERATING SYSTEM STRUCTURE (2B)
• General-purpose OS is very large program
• OS should be easily modifiable.
• A common approach is to partition the task into small components, or
modules, rather than have one single system.
• Each of these modules should be a well-defined portion of the system,
with carefully defined interfaces and functions
• Various ways to structure:
• Simple structure – MS-DOS
• More complex – UNIX
• Layered – an abstraction
• Microkernel – Mach
2.2
MONOLITHIC STRUCTURE – ORIGINAL UNIX
• Simplest structure: no structure at all. Place all of the functionality of
the kernel into a single, static binary file that runs in a single address
space.This is known as Monolithic Structure.
• Eg: UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring.
• The UNIX OS consists of two separable parts
• Systems programs
• The 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
2.3
TRADITIONAL UNIX SYSTEM STRUCTURE
Beyond simple but not fully layered
2.4
LINUX SYSTEM STRUCTURE
Monolithic plus modular design
2.5
LAYERED APPROACH
• The operating system 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.
• With modularity, layers are
selected such that each uses
functions (operations) and
services of only lower-level
layers
2.6
MICROKERNELS
• Moves as much from the kernel into user space
• Mach is an example of microkernel
• Mac OS X kernel (Darwin) partly based on Mach
• Communication takes place between user modules using message
passing
• Benefits:
• Easier to extend a microkernel
• Easier to port the operating system to new architectures
• More reliable (less code is running in kernel mode) and secure
• Detriments:
• Performance overhead of user space to kernel space communication
2.7
MICROKERNEL SYSTEM STRUCTURE
2.8
MODULES
• Many modern operating systems implement loadable kernel
modules (LKMs)
• Uses object-oriented approach
• Each core component is separate
• Each talks to the others over known interfaces
• Each is loadable as needed within the kernel
• Overall, similar to layers but with more flexible
• Linux, Solaris, etc.
2.9
HYBRID SYSTEMS
• Most modern operating systems are not one pure model
• Hybrid combines multiple approaches to address performance,
security, usability needs
• Linux and Solaris kernels in kernel address space, so monolithic,
plus modular for dynamic loading of functionality
• Windows mostly monolithic, plus microkernel for support of
different subsystem personalities
• Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming
environment
• Below is kernel consisting of Mach microkernel and BSD Unix
parts, plus I/O kit and dynamically loadable modules (called kernel
extensions)
2.10
MACOS AND IOS STRUCTURE
• Apple’s macOS is designed to run primarily on desktop and
laptop computer systems.
• IOS is a mobile operating system designed for the iPhone
smartphone and iPad tablet computer
2.11
• macOS is compiled to run on Intel architectures. iOS is compiled
for ARM-based architectures.
• Similarly, the iOS kernel has been modified somewhat to address
specific features and needs of mobile systems, such as power
management and aggressive memory management.
• iOS has more stringent security settings than macOS.
• The iOS is generally much more restricted to developers than
macOS and may even be closed to developers.
• For example, iOS restricts access to POSIX and BSD APIs on iOS,
whereas they are openly available to developers on macOS
Significant distinctions between macOS and iOS
2.12
Best known illustration of a microkernel operating system is Darwin, the
kernel component of the macOS and iOS operating systems. Kernel
environment: This environment, also known as Darwin, includes the Mach
microkernel and the BSD UNIX kernel.
Darwin, in fact, consists of two kernels, one of which is the Mach microkernel.
Darwin, which uses a hybrid structure, is also a layered system that consists
primarily of the Mach microkernel and the BSD UNIX kernel.
Darwin, the core kernel component of macOS, is based on BSD
UNIX and is open-sourced as well - http://www.opensource.apple.com/
Most operating systems provide a single system-call interface to
the kernel—such as through the standard C library on UNIX and Linux systems
— Darwin provides two system-call interfaces: Mach system calls (known as
traps) and BSD system calls (which provide POSIX functionality). The interface
to these system calls is a rich set of libraries that includes not only the
standard C library but also libraries that provide networking, security, and
programming language support. Beneath the system-call interface, Mach
provides fundamental operating system services, including memory
management, CPU scheduling, and interprocess communication (IPC) facilities
such as message passing and remote procedure calls (RPCs). Much of the
functionality provided by Mach is available through kernel abstractions, which
include tasks (a Mach process), threads, memory objects, and ports (used for
IPC).
2.13
DARWIN
• Layered system that consists primarily of the Mach microkernel
and the BSD UNIX kernel.
• Provides two system-call interfaces
2.14
ANDROID
• Open Source: Developed by Open Handset Alliance (mostly Google)
• Similar stack to iOS
• Based on Linux kernel but modified
• Provides process, memory, device-driver and power management
• Runtime environment includes core set of libraries and Dalvik virtual
machine
• Apps developed in Java plus Android API
• Java class files compiled to Java bytecode then translated to
executable; then runs in DalvikVM
• Libraries include frameworks for web browser (webkit), database
(SQLite), multimedia, smaller libc
2.15
ANDROID
ARCHITECTURE
Sl.
No.
Acronym Full Form
1 ART Android Runtime
2 VM Virtual Machine
3 JNI Java Native Interface
4 SSL Secure Socket Layer
5 openGL Open Graphics Library
6 HAL Hardware Abstraction
Layer
7 SQLite Opensource SQL
relational database –
Text mode
2.16
BUILDING AND BOOTING AN OPERATING SYSTEM
• Operating systems generally designed to run on a class of systems
with variety of peripherals
• Commonly, operating system already installed on purchased computer
• But can build and install some other operating systems
• If generating an operating system from scratch
• Write the operating system source code
• Configure the operating system for the system on which it will
run
• Compile the operating system
• Install the operating system
• Boot the computer and its new operating system
2.17
BUILDING AND BOOTING LINUX
• Download Linux source code (http://www.kernel.org)
• Configure kernel via “make menuconfig”
• Compile the kernel using “make”
• Produces vmlinuz, the kernel image
• Compile kernel modules via “make modules”
• Install kernel modules into vmlinuz via “make
modules_install”
• Install new kernel on the system via “make
install”
2.18
SYSTEM BOOT
• When power initialized on system, execution starts at a fixed memory location
• Operating system must be made available to hardware so hardware can start it
• Small piece of code – bootstrap loader, BIOS, stored in ROM or
EEPROM locates the kernel, loads it into memory, and starts it
• Sometimes two-step process where boot block at fixed location loaded
by ROM code, which loads bootstrap loader from disk
• Modern systems replace BIOS with Unified Extensible Firmware
Interface (UEFI)
• Common bootstrap loader, GRUB, allows selection of kernel from multiple
disks, versions, kernel options
• Kernel loads and system is then running
• Boot loaders frequently allow various boot states, such as single user mode
(Boot parameters for the system are set in a
GRUB configuration file, which is loaded at
startup. GRUB is flexible and allows changes to
be made at boot time, including modifying kernel
parameters and even selecting among different
kernels that can be booted).
2.19
OPERATING-SYSTEM DEBUGGING
• Debugging is finding and fixing errors, or bugs
• Also performance tuning
• OS generate log files containing error information
• Failure of an application can generate core dump file capturing memory of
the process
• Operating system 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.”
2.20
PERFORMANCE TUNING
• Improve performance by removing bottlenecks
• OS must provide means of computing and displaying measures of
system behavior
• For example,“top” program orWindowsTask Manager
2.21
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
2.22
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
2.23
LINUX BCC/BPFTRACINGTOOLS
For example, the
command
./opensnoop -p 1225
will trace open() system calls
performed only by the process
with an identifier of 1225.
2.24
ANDROID
MACOS and iOS
DARWIN

More Related Content

Similar to Regarding About Operating System Structure

_Kernel and Kernel Architectures.ppt
_Kernel and Kernel Architectures.ppt_Kernel and Kernel Architectures.ppt
_Kernel and Kernel Architectures.ppt
HardeepKaurCSEAssist
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
dibyajyotig
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
IxtiyorTeshaboyev
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and Properties
Saadi Rahman
 
Introduction to Operating system CBSE
Introduction to Operating system CBSE Introduction to Operating system CBSE
Introduction to Operating system CBSE
PrashantChahal3
 
Linux os
Linux osLinux os
Linux os
MD Mynuddin
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介lclsg123
 
Operating system
Operating systemOperating system
Operating system
Nasrin Borsha
 
Ch02
Ch02Ch02
System structure
System structureSystem structure
System structure
RakshiyaRamya
 
Lecture 4.pptx
Lecture 4.pptxLecture 4.pptx
Lecture 4.pptx
sara591850
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running Modules
YourHelper1
 
Introduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwareIntroduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwaredefinecareer
 

Similar to Regarding About Operating System Structure (20)

_Kernel and Kernel Architectures.ppt
_Kernel and Kernel Architectures.ppt_Kernel and Kernel Architectures.ppt
_Kernel and Kernel Architectures.ppt
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Ch02 system administration
Ch02 system administration Ch02 system administration
Ch02 system administration
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and Properties
 
Studies
StudiesStudies
Studies
 
Introduction to Operating system CBSE
Introduction to Operating system CBSE Introduction to Operating system CBSE
Introduction to Operating system CBSE
 
Linux os
Linux osLinux os
Linux os
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介
 
Module 3 unit 1
Module 3  unit 1Module 3  unit 1
Module 3 unit 1
 
Operating system
Operating systemOperating system
Operating system
 
Ch02
Ch02Ch02
Ch02
 
In a monolithic kerne1
In a monolithic kerne1In a monolithic kerne1
In a monolithic kerne1
 
In a monolithic kerne1
In a monolithic kerne1In a monolithic kerne1
In a monolithic kerne1
 
System structure
System structureSystem structure
System structure
 
Lecture 4.pptx
Lecture 4.pptxLecture 4.pptx
Lecture 4.pptx
 
Walking around linux kernel
Walking around linux kernelWalking around linux kernel
Walking around linux kernel
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running Modules
 
Introduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmwareIntroduction to embedded linux device driver and firmware
Introduction to embedded linux device driver and firmware
 

Recently uploaded

Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 

Recently uploaded (20)

Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 

Regarding About Operating System Structure

  • 1. 2.1 OPERATING SYSTEM STRUCTURE (2B) • General-purpose OS is very large program • OS should be easily modifiable. • A common approach is to partition the task into small components, or modules, rather than have one single system. • Each of these modules should be a well-defined portion of the system, with carefully defined interfaces and functions • Various ways to structure: • Simple structure – MS-DOS • More complex – UNIX • Layered – an abstraction • Microkernel – Mach
  • 2. 2.2 MONOLITHIC STRUCTURE – ORIGINAL UNIX • Simplest structure: no structure at all. Place all of the functionality of the kernel into a single, static binary file that runs in a single address space.This is known as Monolithic Structure. • Eg: UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. • The UNIX OS consists of two separable parts • Systems programs • The 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
  • 3. 2.3 TRADITIONAL UNIX SYSTEM STRUCTURE Beyond simple but not fully layered
  • 5. 2.5 LAYERED APPROACH • The operating system 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. • With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers
  • 6. 2.6 MICROKERNELS • Moves as much from the kernel into user space • Mach is an example of microkernel • Mac OS X kernel (Darwin) partly based on Mach • Communication takes place between user modules using message passing • Benefits: • Easier to extend a microkernel • Easier to port the operating system to new architectures • More reliable (less code is running in kernel mode) and secure • Detriments: • Performance overhead of user space to kernel space communication
  • 8. 2.8 MODULES • Many modern operating systems implement loadable kernel modules (LKMs) • Uses object-oriented approach • Each core component is separate • Each talks to the others over known interfaces • Each is loadable as needed within the kernel • Overall, similar to layers but with more flexible • Linux, Solaris, etc.
  • 9. 2.9 HYBRID SYSTEMS • Most modern operating systems are not one pure model • Hybrid combines multiple approaches to address performance, security, usability needs • Linux and Solaris kernels in kernel address space, so monolithic, plus modular for dynamic loading of functionality • Windows mostly monolithic, plus microkernel for support of different subsystem personalities • Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming environment • Below is kernel consisting of Mach microkernel and BSD Unix parts, plus I/O kit and dynamically loadable modules (called kernel extensions)
  • 10. 2.10 MACOS AND IOS STRUCTURE • Apple’s macOS is designed to run primarily on desktop and laptop computer systems. • IOS is a mobile operating system designed for the iPhone smartphone and iPad tablet computer
  • 11. 2.11 • macOS is compiled to run on Intel architectures. iOS is compiled for ARM-based architectures. • Similarly, the iOS kernel has been modified somewhat to address specific features and needs of mobile systems, such as power management and aggressive memory management. • iOS has more stringent security settings than macOS. • The iOS is generally much more restricted to developers than macOS and may even be closed to developers. • For example, iOS restricts access to POSIX and BSD APIs on iOS, whereas they are openly available to developers on macOS Significant distinctions between macOS and iOS
  • 12. 2.12 Best known illustration of a microkernel operating system is Darwin, the kernel component of the macOS and iOS operating systems. Kernel environment: This environment, also known as Darwin, includes the Mach microkernel and the BSD UNIX kernel. Darwin, in fact, consists of two kernels, one of which is the Mach microkernel. Darwin, which uses a hybrid structure, is also a layered system that consists primarily of the Mach microkernel and the BSD UNIX kernel. Darwin, the core kernel component of macOS, is based on BSD UNIX and is open-sourced as well - http://www.opensource.apple.com/ Most operating systems provide a single system-call interface to the kernel—such as through the standard C library on UNIX and Linux systems — Darwin provides two system-call interfaces: Mach system calls (known as traps) and BSD system calls (which provide POSIX functionality). The interface to these system calls is a rich set of libraries that includes not only the standard C library but also libraries that provide networking, security, and programming language support. Beneath the system-call interface, Mach provides fundamental operating system services, including memory management, CPU scheduling, and interprocess communication (IPC) facilities such as message passing and remote procedure calls (RPCs). Much of the functionality provided by Mach is available through kernel abstractions, which include tasks (a Mach process), threads, memory objects, and ports (used for IPC).
  • 13. 2.13 DARWIN • Layered system that consists primarily of the Mach microkernel and the BSD UNIX kernel. • Provides two system-call interfaces
  • 14. 2.14 ANDROID • Open Source: Developed by Open Handset Alliance (mostly Google) • Similar stack to iOS • Based on Linux kernel but modified • Provides process, memory, device-driver and power management • Runtime environment includes core set of libraries and Dalvik virtual machine • Apps developed in Java plus Android API • Java class files compiled to Java bytecode then translated to executable; then runs in DalvikVM • Libraries include frameworks for web browser (webkit), database (SQLite), multimedia, smaller libc
  • 15. 2.15 ANDROID ARCHITECTURE Sl. No. Acronym Full Form 1 ART Android Runtime 2 VM Virtual Machine 3 JNI Java Native Interface 4 SSL Secure Socket Layer 5 openGL Open Graphics Library 6 HAL Hardware Abstraction Layer 7 SQLite Opensource SQL relational database – Text mode
  • 16. 2.16 BUILDING AND BOOTING AN OPERATING SYSTEM • Operating systems generally designed to run on a class of systems with variety of peripherals • Commonly, operating system already installed on purchased computer • But can build and install some other operating systems • If generating an operating system from scratch • Write the operating system source code • Configure the operating system for the system on which it will run • Compile the operating system • Install the operating system • Boot the computer and its new operating system
  • 17. 2.17 BUILDING AND BOOTING LINUX • Download Linux source code (http://www.kernel.org) • Configure kernel via “make menuconfig” • Compile the kernel using “make” • Produces vmlinuz, the kernel image • Compile kernel modules via “make modules” • Install kernel modules into vmlinuz via “make modules_install” • Install new kernel on the system via “make install”
  • 18. 2.18 SYSTEM BOOT • When power initialized on system, execution starts at a fixed memory location • Operating system must be made available to hardware so hardware can start it • Small piece of code – bootstrap loader, BIOS, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it • Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk • Modern systems replace BIOS with Unified Extensible Firmware Interface (UEFI) • Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options • Kernel loads and system is then running • Boot loaders frequently allow various boot states, such as single user mode (Boot parameters for the system are set in a GRUB configuration file, which is loaded at startup. GRUB is flexible and allows changes to be made at boot time, including modifying kernel parameters and even selecting among different kernels that can be booted).
  • 19. 2.19 OPERATING-SYSTEM DEBUGGING • Debugging is finding and fixing errors, or bugs • Also performance tuning • OS generate log files containing error information • Failure of an application can generate core dump file capturing memory of the process • Operating system 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.”
  • 20. 2.20 PERFORMANCE TUNING • Improve performance by removing bottlenecks • OS must provide means of computing and displaying measures of system behavior • For example,“top” program orWindowsTask Manager
  • 21. 2.21 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
  • 22. 2.22 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
  • 23. 2.23 LINUX BCC/BPFTRACINGTOOLS For example, the command ./opensnoop -p 1225 will trace open() system calls performed only by the process with an identifier of 1225.