Sie sind auf Seite 1von 40

Operating Systems

Operating System
• Operating system primarily is a resource manager
– Resources
• Hardware
– Processors
– Memory
– Input/output devices
– Communication devices

• Software applications
– MS Word
– Internet Explorer
– Windows Live Messenger
– Real Player
Operating System
Operating System
Computer System Architecture
Operating System Components and
Services

Hardware Example OS Services OS Component


Processor Scheduling, Traps, Process Manager
Protections, Synchronization
Memory Protection, Virtual memory Memory Manager

I/O devices Concurrency, Interrupt I/O Manager


handling
File system Management, Persistence File System
Manager
HW Support for OS Services
OS Service Hardware Support
Protection Kernel / User mode
Protected Instructions
Base and Limit Registers
Interrupts Interrupt Vectors

System calls Trap instructions and trap vectors

I/O Interrupts or Memory-Mapping


Scheduling Timer

Synchronization Atomic instructions


OS Kernel
• Portion of operating system that is always in
main memory
• Contains most frequently used functions
• Also called the nucleus

• User Mode
• Kernel Mode
Operating System Architecture
• Monolithic
• Layered
• Microkernel
• Hybrid
Monolithic Architecture
• Monolithic operating system
– Every component contained in kernel
• Any component can directly communicate with any
other
– Tend to be highly efficient
– Disadvantage is difficulty determining source of
subtle errors
Monolithic Architecture
Layered Architecture
• Layered approach to operating systems
– Tries to improve on monolithic kernel designs
• Groups components that perform similar functions into
layers
– Each layer communicates only with layers immediately above
and below it
– Processes’ requests might pass through many layers before
completion
– System throughput can be less than monolithic
kernels
• Additional methods must be invoked to pass data and
control
Layered Architecture
Microkernel Architecture
• Microkernel operating system architecture
– Provides only small number of services
• Attempt to keep kernel small and scalable
– High degree of modularity
• Extensible, portable and scalable
– Increased level of intermodule communication
• Can degrade system performance
Microkernel Architecture
Memory Management
Processor Management
Virtual Computers
Virtual Computers
OS Types
• Server operating systems
– Offer services like print, file, or web
– UNIX, Windows 2000, Linux
• Multiprocessor operating systems
– Parallel computing
• Personal computer operating systems
– Single user with a good GUI, such as Windows 98, Windows 2000, Macintosh
OS, Linux
• Real-time operating systems
– E.g. industrial process control systems where each job must be completed in
the specified time.
– Hard real-time (nuclear reactor control systems) or soft-real time systems (e.g
multimedia systems) depending on the acceptance of missing deadlines
• Embedded operating systems:
– Real-time systems with some resource constraints like memory, CPU, power.
• Distributed operating systems:
– Systems distributed over the networks
Distributed Operating systems
OS History
• First generation 1945 - 1955
– Technology: vacuum tubes & plugboards
– Programming: setting some switches
– Programming language: machine language
– Tasks: tables of sine, cosine, logarithms
– OS: none
• Second generation 1955 – 1965
– Technology: Transistors
– Programming: Punched cards
– Programming languages: FORTRAN & Assembly
– Tasks: Scientific
– Computer: Mainframes
– OS: Batch system
OS History
• Third generation 1965 – 1980
– Technology: Integrated circuits
– Programming: Punched cards
– Programming languages: FORTRAN & Assembly
– Tasks: Scientific & commercial
– Computers: IBM 360, DEC PDPs
– OS: Multiprogramming/timesharing, spooling
• OSes Developed:
– MULTICS (father of all modern OSes)
– UNIX (System V, BSD)
– POSIX (by IEEE)
– MINIX (by Tanenbaum)
OS History
• Fourth generation 1980-Present
– Technology: VLSI
– Programming: High level
– Programming languages: C/C++, Java, ……
– Computer: PC
– OS: Windows, MacOS, Linux ……
Normal Flow of Execution
(Control Flow)
Interrupted flow of execution
Flow of execution with I/O
Interrupted flow of execution with I/O
System Calls
• A special machine instruction
– that causes an interrupt
– various names: syscall, trap
• Usually not generated by HLLs
– but in assembly language functions
Interrupt Vs. System Call
• Interrupts • System call
– Hardware origin – Software origin
– Asynchronous – Synchronous
– Hardware Signals – OS Services

– Signal_Complete() – Read()
– Harddisk read complete
System Call Interface
• The system call interface is the description of the
set of system calls supported by the OS.
• The OS interface is pretty much defined by the
system call interface.
• Typical types of system calls
– Process control
– File management
– Device management
– Information management
– Communication management
System Call Interface
System Call Interface
Application Program Interface
• A set of routines
– Programmers use routines to request services
from the operating system
– Programs call API functions, which may access the
OS by making system calls
– Examples of APIs include:
• Portable Operating System Interface (POSIX) standard
• Windows API
Application Program Interface
Example of Standard API
• Consider the ReadFile() function in the Win32 API—a function for reading from a file

• A description of the parameters passed to ReadFile()


– HANDLE file—the file to be read
– LPVOID buffer—a buffer where the data will be read into and written from
– DWORD bytesToRead—the number of bytes to be read into the buffer
– LPDWORD bytesRead—the number of bytes read during the last read
– LPOVERLAPPED ovl—indicates if overlapped I/O is being used
Exceptions
• Asynchronous
• Generated by software
• Cause an interrupt
• Illegal software operations
– Divide by zero
– Overflow
– Out of bound access
Trap
• To obtain OS services, a user program must
make a system call that traps into kernel mode
and invokes the OS

• Trap instruction switches from user mode to


kernel mode and starts the operating system
(system calls and errors such as division by
zero cause trap instructions)
Virtual Machines
• Virtualization of hardware resources
• Simulates multiple instruction sets
• Can install a variety of parallel running
Operating Systems
Multiprocessing
• ASMP
– Interrupts
– Hard-disk
– Kernel Mode
– User Mode
• Master/Slave
– One Controls remaining
• SMP
– All are equal, scheduled by OS

Das könnte Ihnen auch gefallen