Operating System Structures

Download Report

Transcript Operating System Structures

Course Overview







Introduction
Computer System
Structures
Operating System
Structures
Processes
Process Synchronization
Deadlocks
CPU Scheduling
© 2000 Franz Kurfess








Memory Management
Virtual Memory
File Management
Security
Networking
Distributed Systems
Case Studies
Conclusions
OS Structures 1
Chapter Overview
Operating System Structures








Motivation
Objectives
OS Components
OS Services
System Calls
System Programs
OS Structure
Kernel
© 2000 Franz Kurfess




Virtual Machines
Characteristics of Modern
Operating Systems
Important Concepts and
Terms
Chapter Summary
OS Structures 2
Motivation
 to
understand the functioning of an operating
system, it is important to have an overall view of it
 many components can’t considered in isolation
because they interact with and depend on each
other
 different design approaches are possible with
different underlying hardware capabilities
© 2000 Franz Kurfess
OS Structures 3
Objectives
 get
to know the important components of an
operating system
 understand the interrelationships between the
components
 identify different approaches to the overall design of
operating systems
 be aware of current trends in operating system
design
© 2000 Franz Kurfess
OS Structures 4
OS Components
 process
management
 main memory management
 secondary storage management
 file management
 I/O system management
 networking
 protection
 user interface
© 2000 Franz Kurfess
OS Structures 5
OS Services
 program
execution
 I/O operations
 file and directory services
 communication
 error detection and handling
 resource allocation
 protection
 accounting
© 2000 Franz Kurfess
OS Structures 6
Producing an Executable.
Source Code
Object File
Compile
Executable
Link
Libraries and
other Object files
© 2000 Franz Kurfess
[David Jones
OS Structures 7
System Calls
 interface
between processes and operating system
 used
to request services from the OS
 provides operations on objects that processes can not or
are not allowed to handle directly
 used by programmers, not by users
 types
of system calls
 process
control
 file manipulation
 device manipulation
 information maintenance
 communications
© 2000 Franz Kurfess
OS Structures 8
#include
#include
#include
SystemFunctions
Callssupplied by system
<sys/types.h>
<dirent.h>
"ourhdr.h"
libraries.
These functions will contain a
trap instruction.
int main(int argc, char *argv[])
{
DIR
*dp;
struct dirent *dirp;
if (argc != 2)
err_quit("a single argument (the directory name) is required");
if ( (dp = opendir(argv[1])) == NULL)
err_sys("can't open %s", argv[1]);
while ( (dirp = readdir(dp)) != NULL)
printf("%s\n", dirp->d_name);
closedir(dp);
exit(0);
}
© 2000 Franz Kurfess
[David Jones]
OS Structures 9
Interrupt Handling
Main Memory
User Program #2
User Program #1
trap 002
4
1
3
User Mode
1. Program performs trap
2. OS determines service
number
3. Service is located and
executed.
4. Control returns to user
program.
Based on a diagram from
“Modern Operating Systems” by
Andrew Tanenbaum.
2
Kernel
© 2000 Franz Kurfess
System/Kernel Mode
[David Jones] OS Structures 10
System Programs
 programs
providing more convenient functions to
utilize the system
 directly accessible by the user
 types of system programs
 file
manipulation and modification
 programming environments
 communication
 status information
 command interpreter
© 2000 Franz Kurfess
OS Structures 11
OS Structure
 monolithic
approach
 the
whole OS is one large program
 often used under resource constraints (processing power,
memory space)
 example: PC DOS
 layered
approach
 functionalities
are grouped into layers from hardware to
user programs
 better separation of functions
 example: OS
© 2000 Franz Kurfess
OS Structures 12
Kernel
 core
part of the operating system comprising the
minimal set of functionalities
 process
dispatching
 basic memory management
 interprocess communication
 protection
 is
always kept in main memory
 porting is made easier
© 2000 Franz Kurfess
OS Structures 13
Virtual Machines
 software
abstraction by the OS
 provides an interface identical to the corresponding
hardware
 emulates different hardware architectures on the
same hardware
 isolates users, programs, and processes from each
other
 example: Java Virtual Machine
© 2000 Franz Kurfess
OS Structures 14
Characteristics of Modern
Operating Systems
microkernel architecture
 multithreading
 symmetric multiprocessing
 distributed operating systems
 object-oriented design

© 2000 Franz Kurfess
OS Structures 15
Microkernel Architecture
 kernel
contains only a few essential functions
 address
spaces, interprocess communication, basic
scheduling
 the kernel must be adapted to a specific hardware
 server
processes provide the remaining functionality
in the form of services
 services
can be offered by local or remote server
processes
 flexible
approach, especially for distributed systems
 previous architectures: large, monolithic kernel
includes most of the OS functionality
© 2000 Franz Kurfess
OS Structures 16
Multithreading
 an
application is executed by one or more
processes
 each process may be divided into threads
 threads
are the basic unit of work in an OS
 threads are also known as lightweight processes
 switching between threads is simpler than between
processes
 the general treatment of threads and processes by the OS
is essentially the same
 a thread shares resources with its peers
 good
for the modularity of applications
 allows modules to execute largely independently
© 2000 Franz Kurfess
OS Structures 17
Symmetric Multiprocessing
 provides
more processing power through multiple
processing elements
 the processes share main memory and I/O devices
 the processors are either identical, or can at least
perform the same functions
© 2000 Franz Kurfess
OS Structures 18
Distributed Operating Systems
 all
resources within the distributed system are
available to all processes if they have the right
permissions
 the execution of tasks can be distributed over
several nodes
 there is one single file system encompassing all files
on all nodes
© 2000 Franz Kurfess
OS Structures 19
Object-Oriented Design
 development
method for modular systems
 the interface of modules is independent of the actual
implementation
 internal details of modules are not accessible to
others
 goes well with the microkernel method and
distributed systems
© 2000 Franz Kurfess
OS Structures 20
OS Design Goals
 user
perspective
 convenient,
 system
responsive, easy to use, reliable, safe, fast
perspective
 efficient,
flexible, reliable, easy to design, implement, and
maintain
 difficult
task, requires many tradeoffs
© 2000 Franz Kurfess
OS Structures 21
Applications
Operating
System
Microkernel OS
Micro-Kernel
Main Memory
Control Unit
I/O Devices
Registers
Hardware
CPU
Controllers
Arithmetic Logic
Unit (ALU)
© 2000 Franz Kurfess
System Bus
[David Jones OS Structures 22
Applications
Microkernel OS
Operating
System
Server Processes
Personalities
File System
Device
Drivers
Micro-Kernel
CPU
Main Memory
Control Unit
I/O Devices
Registers
Hardware
System
Services
Controllers
Arithmetic Logic
Unit (ALU)
© 2000 Franz Kurfess
System Bus
[David Jones OS Structures 23
Applications
MicrokernelOS
OS
Microkernel
Users and
User
Programs
Operating
System
Server Processes
Personalities
File System
Device
Drivers
Micro-Kernel
CPU
Main Memory
Control Unit
I/O Devices
Registers
Hardware
System
Services
Controllers
Arithmetic Logic
Unit (ALU)
© 2000 Franz Kurfess
System Bus
[David Jones OS Structures 24
Applications
Distributed OS
Users and
User
Programs
Hardware
Operating
System
Server Processes
Personalities
MicroKernel
Computer
Node
© 2000 Franz Kurfess
MicroKernel
System
Services
MicroKernel
File System
MicroKernel
MicroKernel
Device
Drivers
MicroKernel
Computer Computer Computer Computer Computer
Node
Node
Node
Node
Node
[David Jones OS Structures 25
Future Operating Systems
 micro-kernel
based
 multiple personalities
 emulate
appearance and functionality of existing OSes
 distributed
© 2000 Franz Kurfess
systems
OS Structures 26
OS Structure Examples
 MS-DOS
& Windows
 Windows NT
 Unix
© 2000 Franz Kurfess
OS Structures 27
MS-DOS & Windows Structure
 originally
(DOS 1) monolithic due to space and
processing power restrictions (Intel 8086, 8 KBytes
main memory)
 slow incorporation of advanced concepts
 hard
disk, hierarchical file systems, I/O redirection,
background printing, networking, ...
 fresh
start with Windows NT
 single-user,
multitasking
 designed for 32-bit microprocessors (Intel Pentium)
© 2000 Franz Kurfess
OS Structures 28
Windows NT Structure
 hardware
abstraction layer (HAL)
 provides
adaptation to the underlying hardware through a
generic hardware interface
 microkernel
 thread
scheduling, process switching, exception handling
(interrupts), multiprocessor synchronization
 executive
 modules

services
for system functions
I/O manager, object manager, process manager, virtual memory
manager, security reference monitor, windows modules
 system
services
 interface
© 2000 Franz Kurfess
to software running in user mode
OS Structures 29
Applications and
User Interface
Windows NT
Executive
Users and
Windows
NT
Structure
Microkernel OSUser Programs
POSIX
Subsystem
Win32
Subsystem
OS/2
Subsystem
Security
Subsystem
System Services
Local
Security
Virtual
I/O
Object
Process Procedure
Window
Reference
Memory
Call
Manager Manager
Manager
Manager
Monitor
Manager
Cache
Facility
Manager
File System
Drivers
Network
Drivers
Device
Drivers
Micro-Kernel
Hardware Abstraction Layer (HAL)
Graphic
Device
Drivers
Hardware
© 2000 Franz Kurfess
[Stallings 98] OS Structures 30
Unix Structure
 single
processor, multi-user, multitasking system
 portable through implementation in a high-level
language (C), in contrast to assembly language
 relatively large, non-modular kernel
 access to kernel functions through system calls
 shells as user interface, GUI (XWindows) added
later
 modern Unix variants have been redesigned around
microkernel
© 2000 Franz Kurfess
OS Structures 31
Modern Unix Kernel
elf
a.out
exec
switch
file
mappings
NFS
device
mappings
virtual
memory
framework
anonymous
mappings
disk
driver
vnode/vfs FFS
interface
RFS
Common
Facilities
time-sharing
scheduler
processes
framework
block
device
switch
tape
driver
© 2000 Franz Kurfess
Streams
network
driver
tty
driver
system
processes
[Stallings 98]
OS Structures 32
Important Concepts and Terms















command interpreter
communication
device management
directory system
distributed system
file system
interrupt
kernel
layered structure
memory management
microkernel
monolithic structure
multiprocessing
multiprogramming
multitasking
© 2000 Franz Kurfess















operating system
process
process control block (PCB)
process management
protection
resource allocation
secondary storage management
shell
system call
system program
task
thread
time-sharing
user interface
virtual machine
OS Structures 33
Chapter Summary
 the
operating system provides services and
manages resources
 user processes request services from the OS
through system calls
 protection,
resource management, abstraction
 modern
operating systems separate functions into
modules
 layered
approach, microkernel, object-oriented, virtual
machine
© 2000 Franz Kurfess
OS Structures 34