ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

Embed Size (px)

Citation preview

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    1/28

    LESSON 1 - 1ELET 4300

    ELET4300UNIX Operating System

    Lesson 1Introduction to Modern OS

    Engineering TechnologyCollege of Technology

    University of Houston

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    2/28

    LESSON 1 - 2ELET 4300

    Unit Objectives What is an operating system (OS)?

    Computer System

    Operating Systems How does an operating system differ from a computer program?

    Computer System Architecture

    General Purpose Digital Computer

    Computer System Components Operating System Support Components

    Operating System Goals

    Why Study Operating Systems?

    What Does a Modern Operating System Do?

    Operating System Architecture

    Interrupts, Interrupt Handling, and Interrupt Classes

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    3/28

    LESSON 1 - 3ELET 4300

    What is an Operating System (OS)?

    Sometimes called the executive.

    A software responsible for controlling theallocation and usage of hardware resources.

    A program that acts as an intermediary between auser of a computer and the computer hardware.

    Schedules computer hardware including the CPU,RAM, I/O, disks, etc.

    Simplifies procedures for electronic mail, filetransfer, word-processing, etc.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    4/28

    LESSON 1 - 4ELET 4300

    Banking

    System

    Web

    Browser

    Compilers EditorsCommand

    Interpreter

    Operating System

    Microprograms

    Physical Devices (Hardware)

    Air line

    Reservation

    Machine Language

    Application Programs

    System Programs

    Hardware

    AComputer System

    User

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    5/28

    LESSON 1 - 5ELET 4300

    Operating Systems

    CPM

    MS-DOS

    Windows-95, 98, 2000, XP, NT, 2007

    Unix

    Linux

    AIX Sun Solaris

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    6/28

    LESSON 1 - 6ELET 4300

    How Does an Operating SystemDiffer From a Computer Program?

    The operating system is the host platform forthe compiler (e.g., C, C++, J ava, etc.).

    The operating system can access allhardware devices associated with the system.

    The operating system has extendedcapabilities (scheduling, I/O, file control, etc.).

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    7/28

    LESSON 1 - 7ELET 4300

    Computer SystemArchitecture

    Central Processing Unit (CPU)

    Random-Access Memory (RAM)

    Read-Only Memory (ROM)

    System and Disk Storage Devices

    I/O interface (PIAs, Modems, NICs)

    Peripherals (CD ROMs, DVDs, VGAs, Drivers)

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    8/28

    LESSON 1 - 8ELET 4300

    General PurposeDigital Computer

    CPU

    Data Bus

    Address Bus

    Control Bus

    RAM I/O Interface

    Registers ALU Control

    Peripherals

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    9/28

    LESSON 1 - 9ELET 4300

    Computer System Components Hardware provides basic computing resources

    (CPU, memory, I/O devices)

    Operating System controls and coordinatesthe use of the hardware among the variousapplication programs for the various users

    Application Programs define the ways inwhich the system resources are used to solvethe computing problems of the users (compilers,

    database systems, video games, businessprograms)

    Users (people, machines, other computers)

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    10/28

    LESSON 1 - 10ELET 4300

    Computer-System Operation

    I/O devices and the CPU can executeconcurrently

    Each device controller is in charge of aparticular device type and has a local buffer.

    CPU moves data from/to main memory

    to/fromlocal buffers I/O is from the device to local buffer of

    controller

    Device controller informs CPU that it hasfinished its operation by causing an interrupt

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    11/28

    LESSON 1 - 11ELET 4300

    Conceptual View of a

    Computer System Operation

    Processor . . .

    .

    .

    .

    I/O Controller

    Processor

    I/O Controller

    I/O Controller

    Memory

    Operating

    System

    Software

    Programs

    and Data

    Programs

    I/O Devices

    Data

    OS

    Storage

    .

    .

    .

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    12/28

    LESSON 1 - 12ELET 4300

    Operating SystemSupport Components

    File Manager

    The BIOS (Basic Input/OutputSystem)

    Device Drivers

    Shells Memory Management

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    13/28

    LESSON 1 - 13ELET 4300

    File Manager DOS

    FAT (File AllocationTable)Directory Structure

    File Name Extensions (.BAT, .EXE, .SYS,

    etc.) UNIX

    Paths and directory structure

    Unix directories (/bin, /usr, /tmp, etc.)File permissions (chgrp, chmod, chown)

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    14/28

    LESSON 1 - 14ELET 4300

    Shell User-interface to the operating system.

    DOSSpecifies location of the DOS command interpreter;

    sets environment space.

    UNIXHighly developed (Bourne, C, Korn shells).

    Supports programmable user interface.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    15/28

    LESSON 1 - 15ELET 4300

    UNIX Developed from MULTICS - multi-user interactive

    system supported by a GE-645 mainframe (1965-69)

    Ken Thompson of AT&T Bell Labs developed thefirst UNIX operating system for a DEC PDP-7

    UNIX never intended as a commercial product

    1970s - Universities were encouraged to developand use the UNIX system

    1980s - engineering and CAD applications

    1990s - Server side of a client/server model

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    16/28

    LESSON 1 - 16ELET 4300

    Modern Operating System Goals Efficient Use of Resources

    Avoid bottlenecks that affect performance. Keep all components as busy as possible.

    Convenience and Productivity for Users

    The user costs more than the machine. Deliver function as efficiently as possible.

    Availability and Reliability

    Computer systems are critical. A failed system can mean a failed company.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    17/28

    LESSON 1 - 17ELET 4300

    What Does a Modern OS Do? Provides Abstraction

    Clean interfaces to hardware

    Processes

    Unbounded Memory

    Files

    Synchronization and Communications

    Provides Standard Interface Portability (Unix runs on many very different

    computer systems)

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    18/28

    LESSON 1 - 18ELET 4300

    What Does a Modern OS Do? (Cont.)

    Mediate Resource Usage

    Allow multiple users to share resources fairly,efficiently, safely, and securely

    Multiple Processes

    Multiple Programs

    Consumes Resources Takes up physical memory

    CPU time

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    19/28

    LESSON 1 - 19ELET 4300

    Operating System

    Architecture Most users see total

    package: Windows,Unix

    Tighter integration in

    modern systems

    Hardware

    Operating System

    Libraries Utilities

    Interface

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    20/28

    LESSON 1 - 20ELET 4300

    Other Examples of Abstractions Threads or Processes (Fork)

    Address Spaces (Allocate, Deallocate) Files (Open, Close, Read, Write)

    Messages (Send, Receive)

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    21/28

    LESSON 1 - 21ELET 4300

    Interrupts Interrupt transfers control to the interrupt service

    routine (ISR) generally, through the interrupt

    vector, which contains the addresses of all theservice routines.

    Interrupt architecture must save the address of

    the interrupted instruction. Incoming interrupts are disabled while another

    interrupt is being processed to prevent a lostinterrupt.

    A trap is a software-generated interrupt causedeither by an error or a user request.

    An operating systemis interrupt driven.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    22/28

    LESSON 1 - 22ELET 4300

    Interrupt Handling The operating system preserves the state of the

    CPU by storing registers and the programcounter. Determines which type of interrupt has occurred:

    polling - generally a high-overhead operation

    vectored interrupt system- more efficient Separate segments of code determine what action

    should be taken for each type of interrupt.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    23/28

    LESSON 1 - 23ELET 4300

    Interrupt Classes

    Supervisor Interrupts Initiated by a running process that executes the

    supervisory call instruction.

    Include user request for a particular service:

    Performing I/O Obtaining more storage

    I/O Interrupts

    Initiated by I/O hardware and are caused when anI/O operation completes, when an I/O error occurs,or when an I/O device is made ready.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    24/28

    LESSON 1 - 24ELET 4300

    Interrupt Classes (Cont.)

    External InterruptsInitiated by operator, receipt of signal from another

    processor on a multiprocessor system.

    Restart InterruptsInitiated by consoles restart button, or restartinstruction arrives from another processor on amultiprocessor system.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    25/28

    LESSON 1 - 25ELET 4300

    Interrupt Classes (Cont.)

    ProgramCheck Interrupts Initiated by programs machine language instructions.

    Include division by zero,

    arithmetic overflow or underflow,

    data is in the wrong format,

    attempt to execute an invalid operation code, attempt to reference a memory location beyond the limits of real

    memory,

    attemptby a user process to execute a privileged instruction,

    and an attempt to reference a protected resource.

    Machine Check Interrupts Initiated bymalfunctioning hardware.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    26/28

    LESSON 1 - 26ELET 4300

    Low-Level & High-Level Codes

    Machine code Assembly code (x86 processors)0100 BA0901 MOV DX,0109H

    0103 B409 MOV AH,09H

    0105 CD21 INT 21H

    0107 CD20 INT 20H0109 54 45 53 54 24 0109 DB TEST$

    Shell Script (csh)% echo TEST

    /* C code */ // C++ code#include #include

    #include using namespace std;

    int main(void) int main(void)

    { {

    printf(TEST); cout

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    27/28

    LESSON 1 - 27ELET 4300

    1981 1999 factorCPU (MHz) 10 550 55

    DRAM Capacity 128 KB 128 MB 1000

    Disk capacity 10 MB 16GB 1600

    Net Bandwidth 9600 b/s 155 Mb/s 16000

    #address bit 16 64 4

    Cycles/instruction 3-4 0.5-1 3-8

    History of Operating Systems:

    Change!Typical academic computer in 1981 and 1999

    Operating systems have to vary over time to

    adapt to changing tradeoffs.

  • 7/29/2019 ELET 4300 Lesson 01 Intro to Modern OS Fall 08292013

    28/28

    LESSON 1 - 28ELET 4300

    References1. Operating Systems: Internals and Design PrinciplesWilliam StallingsPrentice Hall; 7th edition (J uly 28, 2011)

    2. Operating Systems: Design and ImplementationAndrew S. Tanenbaum, Albert S. WoodhullPrentice Hall; 3rd edition (J une 15, 2011)

    3. Computer Organization and Architecture: Designing for PerformanceWilliam StallingsPearson Education; International ed of 9th revised edition (May 1, 2012)

    4. Operating System ConceptsAbraham Silberschatz, Peter Baer Galvin, Greg GagneWiley; 8th edition (December 1, 2011)