SlideShare a Scribd company logo
1 of 24
Download to read offline
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.pptHardeepKaurCSEAssist
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modulesdibyajyotig
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfIxtiyorTeshaboyev
 
Linux kernel Architecture and Properties
Linux kernel Architecture and PropertiesLinux kernel Architecture and Properties
Linux kernel Architecture and PropertiesSaadi Rahman
 
Introduction to Operating system CBSE
Introduction to Operating system CBSE Introduction to Operating system CBSE
Introduction to Operating system CBSE PrashantChahal3
 
Linux操作系统01 简介
Linux操作系统01 简介Linux操作系统01 简介
Linux操作系统01 简介lclsg123
 
Lecture 4.pptx
Lecture 4.pptxLecture 4.pptx
Lecture 4.pptxsara591850
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running ModulesYourHelper1
 
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

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

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.