Brian Mitchell ([email protected]) - Operating Systems 1Introduction
Introduction
Operating Systems
User
Programs
OS
Interface
Kernel &DeviceDrivers
Brian Mitchell ([email protected]) - Operating Systems 2Introduction
Introduction
• Instructor Brian Mitchell - “Brian”
[email protected]/~bmitchel
• TA - To Be Announced• Course Information
MCS720 – Tuesday’s 6 - 9 PM
• Online Information www.mcs.drexel.edu/~bmitchel/course/mcs720
Please check course web page several times per week. The web page will be my primary mechanism for communicating:
Special and Emergency Information (posted by 12:00 noon on day of the class)
Syllabus Assignments Exam Information Solutions to Problems
Brian Mitchell ([email protected]) - Operating Systems 3Introduction
Introduction
• Course Objective– To investigate classical internal algorithms
and structures of operating systems– Machine Architectures– Concurrent Programming
• Textbook Applied Operating Systems Concepts, Avi
Silberschatz, Peter Galvin, Greg Gagne
• Additional References Modern Operating Systems, Andrew
Tanenbaum
Distributed Operating Systems, Andrew Tanenbaum
Selected research papers
Brian Mitchell ([email protected]) - Operating Systems 4Introduction
Introduction
• Homework’s, Projects, Exams Programming Projects: This course will
include a significant project that can be worked on individually or in teams. Specifications for the project are on the course web page.
Research Presentation: This course will require you review research papers related to operating systems, as well as present a paper that you select to the class.
Final: There will be a 90 minute final exam
Brian Mitchell ([email protected]) - Operating Systems 5Introduction
Course Topics
• Introduction• Processes & Threads• Process Synchronization• CPU Scheduling• Memory Management• Virtual Memory• Deadlock• File and I/O Systems• Directory Services• Security and Protection• Operating System Case Studies• Special Purpose Operating Systems
– Embedded– JavaOS– WebOS
Brian Mitchell ([email protected]) - Operating Systems 6Introduction
User Programs
Project Introduction
• Learn about the internals of operating systems, operating system algorithms, and operating system and hardware integration.
• Goal: Construct a simulated:– Hardware– Operating System– Assembler
OperatingSystem
Hardware
Brian Mitchell ([email protected]) - Operating Systems 7Introduction
Project Introduction
• Sample Programming Language– Simple, pseudo-assembler based– Instructions:
• Nop, alm, frm, cmp, jeq, jgt, jlt, jge, jle, clr, inc, dec, add, sub, mul, div, mov, and, or, not, xor, hlt, dis
start: alm R1,d500 ;allocate 500 bytes mov R2,#0 ;R2 will hold our offset
looptop: mov (R1)+R2,R2 ;update memory location;with value
inc R2 ;increment R2 cmp R2,d500 ;compare R2 to 500 jlt looptop ;if R2<500 go to looptophalt ;stop execution
Sample Program
Brian Mitchell ([email protected]) - Operating Systems 8Introduction
Project Introduction
• Processing the programs
Get Instruction
Validate Instruction
Fetch and resolve opcode arguments (if any)
Execute Instruction
Check and Handle Faults (if any)
Log Instruction Results in the Hardware Trace
FIRST INSTRUCTION
NEX
T IN
STR
UC
TIO
N
Brian Mitchell ([email protected]) - Operating Systems 9Introduction
Project Introduction
• OS Memory Manager– Linked Lists– First, best, next, worst fit allocation
algorithm– Interface with the page table in hardware– Handle program and page faults– Provide interface to user programs who
require memory– Interface with hardware to manage the
memory
Brian Mitchell ([email protected]) - Operating Systems 10Introduction
Project Introduction
• Simulated hardware
General Purpose Registers
R1 R2 R3 R4 R5 R6 R7 R8
Control Registers
C T PF PC
TLB*
CACHE*
PAGETABLE
Physical Memory SWAP Space
Brian Mitchell ([email protected]) - Operating Systems 11Introduction
Project Information
• Getting Started– Sample code and ant (www.apache.org)
script is provided in the project page
Brian Mitchell ([email protected]) - Operating Systems 12Introduction
Introduction
• Grading– The following distribution will be used to
determine your final grade in this course:• 20%: Phase 1 Project Deliverable• 10%: Phase 2 Project Deliverable• 30%: Phase 3 Project Deliverable• 20%: Research Paper Presentation• 20%: Final Exam
• Policies– Policies governing the project are described
on the project web page. – Makeup exams will take the form of an
oral exam or an alternative test (in-class or take-home).
Brian Mitchell ([email protected]) - Operating Systems 13Introduction
Introduction
• Computer hardware requires software to perform useful operations
• Types of software– Systems Programs: manage the operation of
the computer itself– Application Programs: solve user problems
• The Operating System (OS) is the most fundamental of all systems programs– OS controls ALL of the computers resources– OS provides VALUABLE services to user
programs– OS COORDINATES the execution of user
programs– OS PROVIDES resources to user programs
Brian Mitchell ([email protected]) - Operating Systems 14Introduction
Computer Systems Structure
• Modern computer systems consist of:– One or more processors– Main memory– Clocks (Synchronization, coordination)– Terminals– Disks– Network Interfaces– Input/Output Devices
• Systems Architectures– SISD, SIMD, MIMD, MISD
(we will look at these later)• Processor Organization
– Single Processor– Multiprocessor– Symmetric Multiprocessor– Distributed– Clusters
Brian Mitchell ([email protected]) - Operating Systems 15Introduction
Rationale for OS
• Directly interfacing user programs with hardware is COMPLEX
• Building programs for specific computer architectures is not portable
• If every program included code to interface with the computer hardware– Redundancy– Inconsistent quality– Inefficient use of resources
• DESIRE => Shield programmers from the complexity of the hardware– OS is a layer that sits on top of the
hardware– OS provides an interface or virtual
machine that is easy to understand and program
Brian Mitchell ([email protected]) - Operating Systems 16Introduction
OS Architecture
• Most Operating Systems use a layered architecture
Physical Devices
Microprogramming
Machine Language
Operating System
Compilers Editors CommandInterpreter
BankingSystem
AirlineReservation
WordProcessor U
SER
SYST
EM
HA
RD
WA
RE
Brian Mitchell ([email protected]) - Operating Systems 17Introduction
OS Architecture (con’t)
• Physical Devices– Computer hardware - CPU, memory, I/O
devices, network interfaces
• Microprogramming– ROM-based programs– Controls CISC processors
• Machine Language– Instructions supported by the hardware– Binary encoded– Processors typically support 50-300
instructions• CISC vs RISC
– Use registers as the basis for performing most operations
• Running programs• Device interfaces
Brian Mitchell ([email protected]) - Operating Systems 18Introduction
OS Architecture (con’t)
• Operating Systems– Hide the complexity of software
• Read 200 bytes from file A versus managing the motor and arms of the disk drive
– Provide an interface for the programmer• Usually documented as a set of API’s
– ex: Win32 on Windows98 & WindowsNT– Win32 contains about 6,000 API’s– OpenFile(), CreateProcess(), ...
– Systems software usually sits on top of the kernel of the OS
• Command Interpreter, Security Manager, Utilities (e.g., awk, grep on Unix)
– Most processors support multiple execution modes
• Minimally Kernel/Supervisor and User modes
Brian Mitchell ([email protected]) - Operating Systems 19Introduction
OS Architecture (con’t)
• Operating system runs in Kernel mode and user programs run in User mode
• Kernel Mode– Full access to machine instruction set– Direct access to hardware, memory, and
input/output devices– OS and device drivers must run in Kernel
mode
• User Mode– Access to a limited set of machine
instructions– No direct access to hardware, memory and
input/output devices• Device access is coordinated by OS
– Typically user mode instructions consist of computational instructions
• MS DOS only supported Kernel mode
Brian Mitchell ([email protected]) - Operating Systems 20Introduction
OS Architecture - Summary
• Operating System acts as an extended machine from a user program perspective– Reduce complexity– Increase system integrity– Reduce redundancy
• Operating System acts as a resource manager– Hardware provides many resources to user
programs– Demand for resources may exceed resource
capacity– OS must optimally manage allocation of
the resources• Ex: Memory, Processor/CPU time
Brian Mitchell ([email protected]) - Operating Systems 21Introduction
Example: Web Browser
WEB Browserhttp://www.mcs.drexel.edu
OperatingSystem
Socket API
DeviceDriver
TCP/IP Frames
Network InterfaceCard (NIC)
Memory-Mapped
Electrical Signals Network
User Mode
Switch to Kernel Mode
Kernel Mode
Brian Mitchell ([email protected]) - Operating Systems 22Introduction
History of Operating Systems
• First Generation (1945-1955)– Hardware was tube-based– Programs were hardwired on plugboards– Hardware could run one program at a time– Applications: Numerical Calculations
• Second Generation (1955-1965)– Transistor-based– Assembler - improvement over machine
language– High Level Language - FORTRAN– Batch oriented
• Jobs were created on card or tape• Jobs were serially executed
– Scientific / Engineering applications– Early operating systems introduced
• Capabilities limited to controlling the serial execution of batch jobs
Brian Mitchell ([email protected]) - Operating Systems 23Introduction
History of Operating Systems
• Third Generation (1965-1980)– IC circuits (LSI, VLSI chips)– Business applications supported in addition
to scientific and engineering applications• Business Applications: IO-based• Engineering/Scientific Applications : CPU-
based
– OS supported several new capabilities• Multiprogramming
– Load multiple jobs into memory– When one job was waiting for I/O the OS
ran another job– Job spooling - queue of ready to run jobs
reduced operator intervention
• Timesharing– Support for multiple, concurrent users– OS timeslices user sessions– OS takes responsibility for maximizing
CPU and device utilization
Brian Mitchell ([email protected]) - Operating Systems 24Introduction
History of Operating Systems
• Fourth Generation (1980 - )– Workstations and PC’s– Computer networks become commonplace– CPU’s with millions of transistors offer
high computational power– Desire: User friendly software
Result: Complex operating systems– OS designed to scale and integrate well
with new computer architectures• Real time / Embedded• SMP• CISC, RISC• Parallel• Network
– OS address new concerns• Network transparency• Security
Brian Mitchell ([email protected]) - Operating Systems 25Introduction
History of Operating Systems
• Fifth Generation (2000? - ???? )– OS designed to support massively parallel
computer architectures• Thousands of CPU’s
– MPP architectures may consist of thousands of independent computers connected by high-speed networks
• ex: BISDN at 155Mbits/sec– MPP architectures may consist of processor
boards “plugged” into custom design backplanes
– One or multiple copies of the OS?– Issues
• Cache coherence• Management and coordination of
distributed resources• Bandwidth limitations• Keeping consistent time
Brian Mitchell ([email protected]) - Operating Systems 26Introduction
Special Operating System Types
• Distributed Systems– Goal is to distribute the computation across
several physical processors– Can use either standard networks, or
proprietary inter-connection technologies– Advantages:
• Scalability at low cost• Reliability
– Disadvantages:• Programming is complex• Overhead may be large
• Real time systems– Typically used to control a device– Well defined time constraints must be
respected– General purpose operating systems do not
often handle the requirements of a real-time system
Brian Mitchell ([email protected]) - Operating Systems 27Introduction
Operating System Components
• Process Management– A process is a program in execution– OS manages the creation and deletion of
processes
• Main-Memory Management– OS keeps track of memory in use and free
memory, who is using the memory, allocation and freeing of memory.
• Secondary-Storage Management– OS uses secondary storage to extend
physical memory– Secondary Storage typically resides on disk
• I/O System Management– OS uses the I/O system for management of
devices (device drivers)– Caching– Example: File System
Brian Mitchell ([email protected]) - Operating Systems 28Introduction
Operating System Components
• File Management– OS Manages the creation and deletion of
files, and directories– OS also manages file system permissions
• Who owns the file, who can modify the file
• Protection System– Distinguish authorized versus non-
authorized usage of OS resources
• Networking– Enables OS users to utilize network
resources• Remote disks, Internet, shared printers, file
servers, email, …
• Command-Interpreter System, Graphical User Interfaces– Provides the user with an interface for
using the operating system facilities
Brian Mitchell ([email protected]) - Operating Systems 29Introduction
Operating System Interfaces
• Operating Systems typically provide two interfaces:– User interfaces: Command Line
Interpreter, or graphical user interface– Program interfaces: OS provide interfaces
via application programming interfaces to programs.
• Sometimes called system calls
• System Calls– Operating system designers typically
package system calls as C language function calls
• Example: Win32 on Windows 95/98/NT– Most operating systems also provide
additional classes for better integration with object oriented languages such as C++
• Example: MFC on Windows 95/98/NT
Brian Mitchell ([email protected]) - Operating Systems 30Introduction
Virtual Machines
• A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware.
• A virtual machine provides an interface identical to the underlying bare hardware.
• The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.
• Some operating systems (e.g., VM by IBM), work by running all processes in a virtual machine
• VM concepts are most widely applied in interpretive languages (e.g., Java)– Interface to the machine is facilitated by
the virtual machine