chap. 1) introduction - khu.ac.krmesl.khu.ac.kr/lecture/doc/os10/closed/os-ch01.pdf · 2020. 6....

44
Operating System Chap. 1) Introduction 경희대학교 컴퓨터공학과 조진성

Upload: others

Post on 02-Feb-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Operating System

    Chap. 1) Introduction

    경희대학교 컴퓨터공학과

    조 진 성

  • Operating System 1

    Computer ?

    PersonalComputer

    EmbeddedComputer

    ServerComputer

    Computer SW

    Computer HW

  • Operating System 2

    Computer ?  Computer system components (Abstract view)

  • Operating System 3

    Computer ?  Computer system organization

  • Operating System 4

    Computer ?  Modern PC architecture

    MemoryControllerHub (MCH)

    I/OControllerHub (ICH)

  • Operating System 5

    Operating Systems ?  OS is a resource manager

    Abstraction Sharing

    Time multiplexing Space multiplexing

    Protection Fairness Performance

      Definition in textbook Resource allocator Control program Kernel

    CPU Memory I/O devices …

    Resources

    SW which manages ‘Computer HW’ resources for

    1) convenience2) efficiency

  • Operating System 6

    Computer System Operation  Computer HW architecture (Abstract view)

    Generalpurposeregisters

    PSWSPIRPC

    MMU

    ALU

    CU

    Memory

    I/O device I/O device…

    Bus

  • Operating System 7

    Computer System Operation  CPU operation

    Von Neumann architecture

    Instructions Arithmetic instructions: add, subtract, multiply, divide, … Logical instructions: and, or, xor, not, shift, … Control flow instructions: goto, if, call, return, … Data instructions: load, store, move, input, output, …

  • Operating System 8

    Computer System Operation  Bootstrapping in Linux

    The CPU initializes itself and then execute an instruction at a fixed location (0xfffffff0).

    This instruction jumps into the BIOS/UEFI. BIOS (Basic Input/Output System) UEFI (Unified Extensible Firmware Interface)

    The BIOS/UEFI finds a boot device and fetches Boot Loader(LILO/GRUB). MBR (Master Boot Record) in BIOS ESP (Efi System Partition) in UEFI

    The BIOS/UEFI loads and transfers control to LILO/GRUB. LILO/GRUB loads the compressed kernel. The compressed kernel decompresses itself and transfers control to the

    uncompressed kernel.

  • Operating System 9

    Computer System Operation  CPU

    Instruction Set Architecture (ISA) CISC vs. RISC Intel, SPARC, MIPS, PowerPC, ARM, Alpha, …

    Pipelining Fetch, Decode, Execute, Write Back, etc.

    Instruction-Level Parallelism (ILP) Superscalar vs. VLIW Simultaneous multithreading Multi-core

  • Operating System 10

    Computer System Operation  Multi-core architecture

  • Operating System 11

    Computer System Operation  Symmetric multiprocessing architecture

    Cf) NUMA (Non-Uniform Memory Access) multiprocessing architecture

  • Operating System 12

    Computer System Operation  Clustered system architecture

    Cf) Parallel vs. Distributed system

  • Operating System 13

    Computer System Operation  I/O operation

    I/O request via I/O instruction Direct I/O vs. Memory-mapped I/O Communicates with registers in I/O controller Typically, IR (Instruction Register) & DR (Data Register)

    I/O method Programmed I/O Interrupt DMA (Direct Memory Access)

  • Operating System 14

    Computer System Operation  Interrupt-driven I/O cycle

  • Operating System 15

    Computer System Operation  I/O mode from the perspective of application processes

    Asynchronous/Non-blocking

    Synchronous/Blocking

  • Operating System 16

    Computer System Operation  Interrupt

    Generated by hardware devices (asynchronous) E.g.) timer interrupt, keyboard interrupt, etc.

      Trap Generated by application processes (synchronous) E.g.) system calls

      Fault (Exception) Generated by CPU instructions (synchronous) Divide-by-zero, page fault, protection fault, etc.

      Hardware interrupt vs. Software interrupt

  • Operating System 17

    Computer System Operation  Six steps process to perform DMA transfer

  • Operating System 18

    Computer System Operation  Storage hierarchy

    • ROM vs. RAM• SRAM vs. DRAM

  • Operating System 19

    Computer System Operation  Memory hierarchy

      Caching Cache management policy

    Write-through vs. Write-back Cache coherency

  • Operating System 20

    Computer System Operation  Physical hard disk structure (HDD)

    platters surfaces tracks sectors cylinders arm heads

    platter

    surface

    track sector

    cylinder

    arm

    head

  • Operating System 21

    Computer System Operation  Compact Flash card internals (SSD)

    Processing Unit: FTL(Flash Translation Layer)

    FlashController NAND Flash

    Memory

    DataIN/OUT

    Control

    ARMcore SRAM NOR

    HOSTDMA0/1

  • Operating System 22

    Computer System Operation  System call

    Cf) Function call

    user modekernel mode

    httpd: read( )

    trap to kernel mode; save app state

    find read( ) handler in vector table

    restore app state, return to

    user mode, resume

    trap handler

    read( ) kernel routine

  • Operating System 23

    Computer System Operation  Hardware protection

    CPU protection Timer (periodic interrupt, 10ms in Linux)

    Memory protection Protection fault (E.g. segmentation violation in Linux)

    I/O protection Dual mode operation in CPU Privileged instructions only in kernel mode

  • Operating System 24

    Computer System Operation  OS takes control of the system

    Bootstrapping

    System calls

    Interrupts

    Hardware

    trap

    interrupts

    System call

  • Operating System 25

    Computer History  1st Generation (1945-55)

    Vacuum Tubes and Plugboards

    No OS No Programming Languages No Assembly Languages

  • Operating System 26

    Computer History  2nd Generation (1955-65)

    Transistors and Mainframes

    Batch systems OS is called “Resident Monitor” CPU is underutilized due to the bottleneck in I/O

  • Operating System 27

    Computer History  3rd Generation (1965-80)

    Integrated Circuits (ICs)

    Architectural advances The notion of “Computer Architecture” IBM System/360 family

    Multiprogramming systems Increased CPU utilization

    Time-sharing systems Improved response time Traditional OS features

  • Operating System 28

    Computer History  4th Generation (1980-)

    LSIs & VLSIs

    Architectural advances Microprocessors: smaller and faster Storages: larger and faster CPU work is offloaded to I/O devices Personal computers (Desktop system)

    Modern OS Features GUI (Graphical User Interface) Multimedia Internet & Web Networked / Distributed, etc.

  • Operating System 29

    Computing Environments  Traditional computing

    Mainframe system Batch system Multiprogramming system Time-sharing system

    Desktop system

      Mobile computing Hand-held system

    Limited memory Slow processors Small display screens

      Real-time embedded computing Real-time systems

    Hard real-time vs. Soft real-time Embedded systems

  • Operating System 30

    Computing Environments  Client-server computing

    Large-scale server in data center Clustered server

    Parallel + Distributed + Storage

  • Operating System 31

    Computing Environments  Peer-to-peer computing

    Discovery protocol Napster, Gnutella, VoIP, etc.

      Cloud computing Infrastructure as a Service (IaaS) Platform as a Service (PaaS) Software as a Service (SaaS)

  • Operating System 32

    Computing Environments  Virtualization

    VMM or Hypervisor

    Non-virtual Machine Virtual Machine

  • Operating System 33

    Computing Environments  Virtual machine examples

      Java JVM executes “platform-neutral byte-codes” JIT (Just-In-Time) compilers increase performance

    Hardware

    Windows

    WindowsProcesses

    VMWare

    Linux

    LinuxProcesses

    Hardware

    Mac OS X

    MacProcesses

    Parallels

    Windows

    WindowsProcesses

    Parallels

    Linux

    LinuxProcesses

    JVM

    JavaThreads

    JVM

    JavaThreads

  • Operating System 34

    Computing Environments  Distributed computing

    Collection of separate, possibly heterogeneous, systems networked together Network operating systems provides illusion of a single system E.g.) Hadoop

  • Operating System 35

    OS HistoryA long time ago,

    in a galaxy far, far away, …

      IBM OS/360: Multiprogramming

      MIT CTSS (Compatible Time-Sharing System)

      MIT, Bell Labs, GE, MULTICS(MULTiplexed Information and Computing Service)

    And Unix was born in 1969

  • Operating System 36

    OS History: Unix (1969-85)

    USG/USDL/ATTISDSG/USO/USL

    Bell LaboratoriesResearch

    Berkeley SoftwareDistributions

    1969 First Edition

    1973 Fifth Edition

    1976 Sixth Edition

    1977 PWB MERT CB UNIX 1BSD

    1977 UNIX RT Seventh Edition 2BSD

    32V

    1979 3BSD

    3.0 4.0BSD

    1980 XENIX 3.0.1

    1981 4.0.1 4.1BSD

    1982 5.0 Sys tem III 4.1aBSD

    1983 5.2 Sys tem V XENIX 3 Eighth 4.1cBSDEdition

    2.9BSD

    2.8BSD

    1984 Sys tem V SunOS 4.2BSDRelease 2

    1985

    Figure 1.1 The UNIX system family tree, 1969-1985

  • Operating System 37

    OS History: Unix (1985-96)

    System V Eighth1985 Release 2 XENIX 3 SunOS Edition 4.2BSD 2.9BSD

    1986 MACH 4.3BSD

    Sys tem V1987 Release 3 Ninth 2.10BSD Chorus Edition

    XENIX 5

    1988 MACH 2.5 4.3BSD-Tahoe

    Sys tem V1989 Release 4 NeXT SunOS4 Tenth 2.11BSD

    Step Edit ion

    SunOS3

    Chorus NET/1 V3

    1990 OSF/1 Plan 9 4.3BSD-Reno

    1991 NET/2

    386BSD

    1992 Solaris NetBSD 0.8

    DEC UNIX BSDI 1.0 FreeBSD 1.0 Novell1993 Linux UNIX Solaris 2

    Ware 4.4BSD

    1994 4.4BSD Lite-1

    1995 SCO FreeBSD 2.0 BSDI 2.0 UNIX 4.4BSD

    Lite-21996

    Figure 1.2 The UNIX system family tree, 1986-1996

  • Operating System 38

    OS History: Unix (1997-)  Sun Solaris  HP HP-UX  IBM AIX  Caldera (SCO) Unixware  Compaq (Digital) Tru64  SGI Irix  Linux, FreeBSD, NetBSD  Apple Mac OS X, etc.

      Cf) POSIX

  • Operating System 39

    OS History: Windows & Linux

    1.0 2.0 3.0 3.2 4.0

    3.0 3.1

    5.0 6.0

    3.1 3.51

    7.0

    95

    4.0

    98

    2K XP

    1981 82 84 86 88 90 91 93 94 95 98 00 01

    ME

    0.01 0.99 1.0 1.2 2.0

    96 97 99

    1.0

    92

    98SE2.0

    3.1 3.11

    2.1 2.2 2.4

    MS-DOS Family

    Windows Family

    Windows for WorkGroup Family

    Windows NT Family

    Linux

  • Operating System 40

    OS History: Windows & Linux

    07 09

    2.6.33

    10 15

    A.B.CA: Kernel versionB: Major revisionC: Minor revision

    04

    2.6.0

    Windows 8

    12

    3.2.0 4.4.0

  • Operating System 41

    OS History: Linux  1983

    Richard Stallman, GNU project and free software concept gcc, gdb, glibc, and other tools

      1991 Linus Tovalds, Linux kernel project Completely free operating system: Linux/GNU

      1995 Linux is more and more popular on server systems

      2000 Linux is more and more popular on embedded systems

      2008 Linux is more and more popular on mobile devices

      2010 Linux is more and more popular on phones

  • Operating System 42

    OS History: Linux  Television

      Personal router

      PoS (Point of Sales) terminal

      Laser cutting machine

      Viticulture machine

  • Operating System 43

    OS History: Taxonomy   Mainframe systems

    CTS, MULTICS, IBM MVS, VM  Desktop systems

    DOS, Windows, MacOS, Unix/Linux  Distributed systems

    Amoeba(Vrije Univ.), Locus(UCLA), Grapevine(Xerox), V(Stanford), Eden(U. of Washington), Chorus/Nucleus(Inria)

      Embedded systems Vertex, pSOS, VxWorks, OSE, Windows-CE, Embedded Linux Company-proprietary OS (Cisco, Qualcomm, Palm, Cellvic)

      Real-time systems Real-Time Linux, Spring(U. of Massachusetts), HARTS(U. of Michigan),

    MARUTI(U. of Maryland)