Chapter 2 Slides
Chapter 2 Slides
Chapter 2: Operating-System
Structures
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.2 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 1
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Objectives
To describe the services an operating system provides to
users, processes, and other systems
To discuss the various ways of structuring an operating
system
To explain how operating systems are installed and
customized and how they boot
Operating System Concepts – 10th Edition 2.3 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.4 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 2
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.5 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.6 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 3
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.7 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.8 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 4
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.9 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.10 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 5
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Touchscreen Interfaces
Operating System Concepts – 10th Edition 2.11 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.12 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 6
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
System Calls
Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++)
Mostly accessed by programs via a high-level
Application Programming Interface (API) rather than
direct system call use
Three most common APIs are Win32 API for Windows,
POSIX API for POSIX-based systems (including virtually
all versions of UNIX, Linux, and Mac OS X), and Java API
for the Java virtual machine (JVM)
Operating System Concepts – 10th Edition 2.13 Silberschatz, Galvin and Gagne ©2018
System call sequence to copy the contents of one file to another file
Operating System Concepts – 10th Edition 2.14 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 7
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.15 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.16 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 8
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.17 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.18 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 9
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.19 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.20 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 10
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
Operating System Concepts – 10th Edition 2.21 Silberschatz, Galvin and Gagne ©2018
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes
Communications
create, delete communication connection
send, receive messages if message passing model to host
name or process name
4 From client to server
Shared-memory model create and gain access to memory
regions
transfer status information
attach and detach remote devices
Operating System Concepts – 10th Edition 2.22 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 11
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Protection
Control access to resources
Get and set permissions
Allow and deny user access
Operating System Concepts – 10th Edition 2.23 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.24 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 12
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.25 Silberschatz, Galvin and Gagne ©2018
Example: MS-DOS
Single-tasking
Shell invoked when system
booted
Simple method to run
program
No process created
Single memory space
Loads program into memory,
overwriting all but the kernel
Program exit -> shell
reloaded
Operating System Concepts – 10th Edition 2.26 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 13
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Example: FreeBSD
Unix variant
Multitasking
User login -> invoke user’s choice of
shell
Shell executes fork() system call to create
process
Executes exec() to load program into
process
Shell waits for process to terminate or
continues with user commands
Process exits with:
code = 0 – no error
code > 0 – error code
Operating System Concepts – 10th Edition 2.27 Silberschatz, Galvin and Gagne ©2018
System Programs
System programs provide a convenient environment for program
development and execution. They can be divided into:
File manipulation
Status information sometimes stored in a File modification
Programming language support
Program loading and execution
Communications
Background services
Application programs
Most users’ view of the operation system is defined by system
programs, not the actual system calls
Operating System Concepts – 10th Edition 2.28 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 14
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
System Programs
Provide a convenient environment for program development and
execution
Some of them are simply user interfaces to system calls; others
are considerably more complex
Status information
Some ask the system for info - date, time, amount of available
memory, disk space, number of users
Others provide detailed performance, logging, and debugging
information
Typically, these programs format and print the output to the
terminal or other output devices
Some systems implement a registry - used to store and
retrieve configuration information
Operating System Concepts – 10th Edition 2.29 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.30 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 15
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Application programs
Don’t pertain to system
Run by users
Not typically considered part of OS
Launched by command line, mouse click, finger poke
Operating System Concepts – 10th Edition 2.31 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.32 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 16
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.33 Silberschatz, Galvin and Gagne ©2018
Implementation
Much variation
Early OSes in assembly language
Then system programming languages like Algol, PL/1
Now C, C++
Actually usually a mix of languages
Lowest levels in assembly
Main body in C
Systems programs in C, C++, scripting languages like PERL,
Python, shell scripts
More high-level language easier to port to other hardware
But slower
Emulation can allow an OS to run on non-native hardware
Operating System Concepts – 10th Edition 2.34 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 17
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.35 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.36 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 18
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.37 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.38 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 19
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Layered Approach
Operating System Concepts – 10th Edition 2.39 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 2.40 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 20
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
messages messages
microkernel
hardware
Operating System Concepts – 10th Edition 2.41 Silberschatz, Galvin and Gagne ©2018
Modules
Many modern operating systems implement loadable kernel
modules
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
Operating System Concepts – 10th Edition 2.42 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 21
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.43 Silberschatz, Galvin and Gagne ©2018
Hybrid Systems
Most modern operating systems are actually 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 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)
Operating System Concepts – 10th Edition 2.44 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 22
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Mac OS X Structure
kernel environment
BSD
Mach
Operating System Concepts – 10th Edition 2.45 Silberschatz, Galvin and Gagne ©2018
iOS
Operating System Concepts – 10th Edition 2.46 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 23
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Android
Developed by Open Handset Alliance (mostly Google)
Open Source
Similar stack to IOS
Based on Linux kernel but modified
Provides process, memory, device-driver management
Adds power management
Runtime environment includes core set of libraries and Dalvik
virtual machine
Apps developed in Java plus Android API
4 Java class files compiled to Java bytecode then translated
to executable than runs in Dalvik VM
Libraries include frameworks for web browser (webkit), database
(SQLite), multimedia, smaller libc
Operating System Concepts – 10th Edition 2.47 Silberschatz, Galvin and Gagne ©2018
AndroidApplications
Architecture
Application Framework
surface media
Dalvik
manager framework
virtual machine
webkit libc
Linux kernel
Operating System Concepts – 10th Edition 2.48 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 24
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating-System Debugging
Operating System Concepts – 10th Edition 2.49 Silberschatz, Galvin and Gagne ©2018
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
Operating System Concepts – 10th Edition 2.50 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 25
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
DTrace
Example of following
XEventsQueued system call
move from libc library to
kernel and back
Operating System Concepts – 10th Edition 2.51 Silberschatz, Galvin and Gagne ©2018
Dtrace (Cont.)
Operating System Concepts – 10th Edition 2.52 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 26
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
Operating System Concepts – 10th Edition 2.53 Silberschatz, Galvin and Gagne ©2018
System Boot
When power initialized on system, execution starts at a fixed
memory location
Firmware ROM used to hold initial boot code
Operating system must be made available to hardware so hardware
can start it
Small piece of code – bootstrap loader, 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
Common bootstrap loader, GRUB, allows selection of kernel from
multiple disks, versions, kernel options
Kernel loads and system is then running
Operating System Concepts – 10th Edition 2.54 Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 27
EECE 432: Operating Systems
Chapter 2: Operating-System Structures
AUB
End of Chapter 2
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018
Imad Moukadem 28