PowerPoint Presentation
Slide 1
Operating System Structures
& User Interface
Slide 2
Lecture Objective / Overview
In this lecture, we shall see:
◆ Operating System Services
◆ System Calls / OS Relationship
◆ OS Design and Implementation
◆ Operating System Structure
◆ User Classes & Interfaces
References:
Chapter # 2: Operating System Concepts (9th edition) by Silberschatz, Galvin & 3
What is part of an Operating System?
◆ When you install an OS, what do you get?
◼System programs – program loader, command interpreter
◼Language processors – C compiler, assembler, linker
◼Utilities – text editor, terminal emulator
◼Subroutine libraries – standard C library, JVM
Slide 4
Operating System Services
Slide 5
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)
Slide 6
System Calls – Example
Slide 7
API – System Call – OS Relationship
#include
open(const char *pathname, int flags);
Slide 8
System Call Implementation
◆ Typically, a number is associated with each system call
◼System-call interface maintains a table indexed according to
these numbers
◆ The system call interface invokes intended system call
in OS kernel and returns status of the system call and
any return values
◆ The caller doesn’t need to know implementation details
◼Just needs to obey API and understand what OS will do!
◼Most details of OS interface hidden from programmer by API
◼Managed by run-time support libraries (set of functions built
into libraries included with compiler)
Slide 9
Examples of Windows and Unix System Calls
Slide 10
Standard C Library Example
◆ C program invoking printf() library call, which calls write() system call
Slide 11
Operating System Design and Implementation
◆ Design and Implementation of OS not “solvable”, but some
approaches have proven successful
◆ Internal structure of Operating Systems can vary widely
◆ Start the design by defining goals and specifications
◆ Affected by choice of hardware, type of system
◆ User goals and System goals
◼User goals – operating system should be convenient to use, easy
to learn, reliable, safe, and fast
◼System goals – operating system should be easy to design,
implement, and maintain, as well as flexible, reliable, error-free,
and efficient
Slide 12
Implementation
◆ Much variation
◼Early OSes in assembly language
◼Then system programming languages like Algol, PL/1
◼Now C, C++
◆ 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 are easier to port to other hardware
◼But slower
◆ Emulation can allow an OS to run on non-native hardware
Slide 13
Operating System Structure
◆ General-purpose OS is a very large program
◆ Various ways to structure an OS
◼Simple structure – MS-DOS
◼More complex – UNIX
◼Layered – An Abstraction
◼Microkernel – Mach
◼Modular and Hybrid
Slide 14
Simple Structure – MS DOS
◆ MS-DOS – written to provide
the most functionality in the
least space
◼Not divided into modules
◼Although MS-DOS has some
structure, its interfaces and
levels of functionality are not
well separated
Slide 15
Non Simple Structure – UNIX
◆ 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
Slide 16
Traditional UNIX System Structure
◆ Beyond simple but not fully layered!
Slide 17
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
Slide 18
Microkernel System Structure
Application
Program
File
System
Device
Driver
Interprocess
Communication
memory
managment
CPU
scheduling
messagesmessages
microkernel
hardware
user
mode
kernel
mode
Slide 19
Microkernel System Structure
◆ Moves as much from the kernel into user space
◆ Mach 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)
◼More secure
◆ Detriments:
◼Performance overhead of user space to kernel space
communication
Slide 20
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 flexibility
◼Linux, Solaris, etc.
Slide 21
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
◆ OS X hybrid, layered, Aqua UI plus Cocoa
programming environment
Slide 22
Mac OS X Structure
graphical user interface
Aqua
application environments and services
kernel environment
Java Cocoa Quicktime BSD
Mach
I/O kit kernel extensions
BSD
Slide 23
User Interfaces
Almost all operating systems have a user interface.
This interface can take several forms.
◆ Command-line Interface (CLI)
◆ Batch Interface – commands and directives entered
into files, which are then executed
◆ Graphical User Interface (GUI)
Slide 24
User Interfaces – Key Information
◆ Any UI requires a software link to hardware
◼This link may be buried under other software
◆ Most OS’s provide a set of system calls that invoke
low level operating system functions
◆ System calls can be invoked directly, but are often
hidden from user
Slide 25
User Classes
1) Operational (Admins)
◆ Concerned with provision, operation and management
of computing facilities
Slide 26
User Classes
2) End-users
◆ Someone who applies
software to some problem
area. Two extremes:
◼Unaware they’re interacting
with a computer
◼Substantial understanding of
computer
Slide 27
Types of Interface
1) System Calls:
◆ All interaction with hardware has to go through system call
◆ OS provides layer of subroutines called an API
Slide 28
Types of Interface
2) Command Language:
◆ Most OS’s provide an interactive terminal
◆ Commands can be entered here
◆ Used to imitate programs
◆ Perform housekeeping control routines on system
◆ UNIX provides shell programs
Slide 29
Types of Interface
3) Job Control Language:
◆ Define requirements for work submitted to a batch system
◆ Used for DBs
Slide 30
Types of Interface
4) Graphical User Interface
◆ Interaction via windows and mouse driven environment
◆ Desktop, Icons, GUI APIs – Java X Windows
◆ Programmer’s Perspective
◼Slightly more complex than shell script, but more rewarding
◼Event driven programming – responsive to user actions
◆ User viewpoint – friendlier?
◆ Increased processing load
Slide 31
Types of Interface
Slide 32
Types of Interface
5) Touchscreen Interfaces
◆ Touchscreen devices
require new interfaces
◆ Mouse not possible or
not desired
◆ Actions and selection
based on gestures
◆ Virtual keyboard for text
entry
Slide 33
Summary
What elements of a computer system have we looked at:
◆ Operating System Services
◆ System Calls / OS Relationship
◆ OS Design and Implementation
◆ Operating System Structure
◆ User Classes & Interfaces