Title: 1' Introduction
11. Introduction
- 1.1 The Role of Operating Systems
- - Bridge the Semantic Gap between
Hardware and Application - - Three Views of Operating Systems
- 1.2 Organization of Operating Systems
- - Structural Organization
- - The Hardware Interface
- - The Programming Interface
- - The User Interface
- - Runtime Organization
- 1.3 Operating System Evolution Concepts
2Single CPU System
Figure 1-1
3Bridging the Semantic Gap
- Hardware capabilities are very low level
- Arithmetic and logical operators
- Comparison of two bit-strings
- Branching, reading, and writing bytes
- User needs to think in terms of problem to be
solved - High-level data structures and corresponding
operations - Simple, uniform interfaces to subsystems,
- Treat programs and data files as single entities
- Use software to bridge this gap
- Language processors (e.g., assemblers, compilers,
interpreters). - Editors and text processors, linkers and loaders.
- Application programs, utility and service
programs. - Operating Systems
4The role of OSs
- Bridge Hardware/Application Gap
- Machine instruction vs high level operation
- compiler bridges gap
- Linear memory vs data structures
- compiler bridges gap
- Limited CPU memory vs more needed
- OS bridges gap
- Secondary memory devices vs files
- OS bridges gap
- I/O devices vs high level I/O commands
- OS bridges gap
5Multiprocessor Systems
Figure 1-2a
Figure 1-2b
6Multicomputer System
Figure 1-2c
7PC Hardware Organization
Figure 1-7
8Three views of OSs
- OS is an extended machine
- Principle of abstraction hides complexity
- OS provides high level operations using lower
level operations - OS is a virtual machine
- Principle of virtualization supports sharing
- OS provides virtual CPU, memory, devices
- OS is a resource manager
- Balance overall performance with individual needs
(response time, deadlines)
9Structural Organization of OSs
Figure 1-8
10Organization of OSs
- Hardware Interface
- Applications and OS compiled into machine
instructions - Interrupts and Traps allow OS to seize control
- process management (time-sharing)
- device management (I/O completion)
11Principles of Interupts and Traps
Figure 1-9
12Organization of OSs
- Hardware interface (continued)
- Modes of CPU execution
- Privileged/Nonprivileged
- SVC (supervisor call) causes trap
- Control transferred to OS in privileged mode
- OS exits privileged mode when returning to user
13Organization of OSs
- Programming Interface
- Invoking system services
- Library call (nonprivileged)
- Kernel call (privileged)
Figure 1-8
14Invoking System Services
Figure 1-10
15Organization of OSs
- User interface (cf. Fig. 1-8)
- Text-based shell (e.g. Unix)
- command interpreter
- shell scripts
- Graphics-based GUI (e.g. Mac, MS Windows)
- Windows
- Icons
- Menus
- Pointer
16Organization of OSs
- Runtime organization
- Service is a Subroutine
- Service is an Autonomous Process
(client-server)
Figure 1-12
17OS Evolution and Concepts
- Early systems
- Bootstrapping
- Batch OSs
- I/O processors
- Interrupts
- Relocatable code
- Multiprogramming
18Multiprogramming
- Basic problem
- Some programs are compute-bound, some I/O-bound
- Even balanced programs are balance only over
time - No one program can make full use of the system
- Solution Multiprogramming
- Have more than one active (running) program in
memory at any one time - Multiprogramming requires
- Bridging the semantic gap
- Sharing resources among different programs
- Hiding from each program the fact of this sharing
19OS Evolution and Concepts
- Multiprogramming Systems
- Overlap CPU and I/O
- Protection
- Synchronization and Communication
- Dynamic Memory Management (swapping and
paging) - Interactive OSs
- Guaranteed response time
- Time-sharing (quantum)
20Batch Processing
- Uses multiprogramming
- Job (file of OS commands) prepared offline
- Batch of jobs given to OS at one time
- OS processes jobs one-after-the-other
- No human-computer interaction
- OS optimizes resource utilization
- Batch processing (as an option) still used
- today
21Shell Command Line Interpreter
Interactive User
Application System Software
Shell Program
OS System Call Interface
OS
22The Shell Strategy
grep first f3
fork a process
read keyboard
Shell Process
Process to execute command
f3
read file
23Initializing a UNIX Machine
Serial Port A
login
Serial Port B
login
Serial Port C
login
Serial Port Z
login
getty
/etc/passwd
24A Shell Script Batch File
- gcc -g -c menu.c
- gcc -g -o driver driver.c menu.o
- driver lt test_data gt test_out
- lpr Ppr0 test_out
- tar cvf driver_test.tar menu.c driver.c
test_data test_out - uuencode driver_test.tar driver_test.tar
gtdriver_test.encode
25UNIX Files
- UNIX and NT try to make every resource (except
CPU and RAM) look like a file - Then can use a common interface
open Specifies file name to be used close
Release file descriptor read Input a block of
information write Output a block of
information lseek Position file for
read/write ioctl Device-specific operations
26UNIX File Example
include ltstdio.hgt include ltfcntl.hgt int
main() int inFile, outFile char
inFileName in_test char outFileName
out_test int len char c inFile
open(inFileName, O_RDONLY) outFile
open(outFileName, O_WRONLY) / Loop through the
input file / while ((len read(inFile, c,
1)) gt 0) write(outFile, c, 1) / Close
files and quite / close(inFile)
close(outFile)
27OS Evolution and Concepts
- PC and workstation OSs
- GUI
- Real-time OSs
- Deadlines (scheduling)
- Distributed OSs
- Loosely coupled/tightly coupled
- Consistent timeline (logical clocks, time stamps)
28Examples of Modern OS
- UNIX variants (e.g. Linux) -- have evolved since
1970 - Windows NT/2K -- has evolved since 1989
- VxWorks for real-time
- Research OSes still evolving
- Small computer OSes still evolving
29Requirements from a Modern OS
- 1. Micro-kernel structure
- Scheduling
- Networking
- Device Drivers
- Memory Management
- Scheduling
- IP Communication
- Everything else is built as utilities
30Requirements (cont.)
- 2. Multi-threading
- - A process consists of threads
- - Threads run concurrently
- - A thread is schedulable and interruptable
- - User and kernel threads
- 3. Symmetric Multiprocessing
- - More than one processors -gt speed and fault
tol. - - Incremental growth is possible
31Requirements (cont.)
- 4. Distributed Operating System
- - Running on many processors (clusters)
- - Vision of one OS
- - Fault Tolerance increased
- - Performance, resource utilization
- - Still a research issue not many around
- - Distributed and Mobile and Real-time ???
- that seems to be the future of OS !
32Processor Modes
- Mode bit Supervisor or User mode
- Supervisor mode
- Can execute all machine instructions
- Can reference all memory locations
- User mode
- Can only execute a subset of instructions
- Can only reference a subset of memory locations
33Kernels
- The part of the OS critical to correct operation
(trusted software) - Executes in supervisor mode
- The trap instruction is used to switch from user
to supervisor mode, entering the OS
34Supervisor and User Memory
User Space
User Process
Supervisor Process
Supervisor Space
35Procedure Call and Message Passing Operating
Systems
call()
trap
return
36System Call Using the trap Instruction
fork()
Kernel
Trap Table
fork() trap N_SYS_FORK()
sys_fork()
sys_fork() / system function / return
37A Thread Performing a System Call
User Space
Kernel Space
Thread
fork()
sys_fork()
38Basic Operating System Organization
Process, Thread Resource Manager
Processor(s)
Main Memory
Devices
39The UNIX Architecture
Interactive User
Libraries
Commands
Application Programs
OS System Call Interface
Trap Table
Device Driver
- Monolithic Kernel Module
- Process Management
- Memory Management
- File Management
- Device Mgmt Infrastructure
Device Driver
Driver Interface
Device Driver
40Microkernel Organization
Process
Process
Libraries
Process
User
Supervisor
Server
Server
Server
Device Drivers
Microkernel
Processor(s)
Main Memory
Devices
41Windows NT Organization
Process
Process
T
T
Process
T
T
T
T
Libraries
T
T
T
Process Management Memory Management File
Management Device Mgmt Infrastructure
Subsystem
Subsystem
Subsystem
User
Supervisor
I/O Subsystem
NT Executive
NT Kernel
Hardware Abstraction Layer
Processor(s)
Main Memory
Devices
42Abstraction
- E.W.Dijkstra, The Humble Programmer (1972)
The purpose of abstraction is not to be vague,
but to create a new semantic levelin which one
can be absolutely precise. - abstraction is created by distinguishing
- Essential characteristics fromUnimportant
details - Build levels (layers) of abstractions
- What is unimportant detail at one levelis an
essential characteristic at a lower one.