1 / 40

Lecture #1

Lecture #1. Computer System Overview. 강의 개요. 운영체제는 컴퓨터 시스템의 하드웨어를 제어하여 사용자에게 프로그램을 실행할 수 있는 환경을 제공한다 운영체제에 있어 중요한 컴퓨터 하드웨어 측면을 살펴본다. 컴퓨터 시스템의 구성. 컴퓨터 시스템의 계층적 구성 하드웨어( Hardware) 소프트웨어( Software) 시스템 소프트웨어( System Software) 운영체제( Operating System) 유틸리티( Utility)

Download Presentation

Lecture #1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture #1 Computer System Overview 신라대학교 컴퓨터공학과 - 운영체제

  2. 강의 개요 • 운영체제는 컴퓨터 시스템의 하드웨어를 제어하여 사용자에게 프로그램을 실행할 수 있는 환경을 제공한다 • 운영체제에 있어 중요한 컴퓨터 하드웨어 측면을 살펴본다 신라대학교 컴퓨터공학과 - 운영체제

  3. 컴퓨터 시스템의 구성 • 컴퓨터 시스템의 계층적 구성 • 하드웨어(Hardware) • 소프트웨어(Software) • 시스템 소프트웨어(System Software) • 운영체제(Operating System) • 유틸리티(Utility) • 응용 프로그램(Application Program) cf) 미들웨어(Middleware) 신라대학교 컴퓨터공학과 - 운영체제

  4. End User Programmer Middleware Application Programs Utilities Operating- System Designer Operating-System Computer Hardware 컴퓨터 시스템의 계층적 구조 신라대학교 컴퓨터공학과 - 운영체제

  5. Basic Hardware Components • Processor (CPU) • Main Memory • 현재 실행중인 프로그램과 데이터를 저장 • I/O modules (I/O controllers, I/O processors...) • 주변 장치와 CPU 사이에 데이터를 전송하는 하드웨어 • secondary memory devices (e.g: hard disks) • keyboard, display... • communications equipment • System interconnection (e.g: Buses) • communication among processors, memory, and I/O modules 신라대학교 컴퓨터공학과 - 운영체제

  6. Monitor Bus Components of a simple personal computer 신라대학교 컴퓨터공학과 - 운영체제

  7. Computer Hardware Architecture 신라대학교 컴퓨터공학과 - 운영체제

  8. CPU와 주기억장치 신라대학교 컴퓨터공학과 - 운영체제

  9. CPU Registers (fast memory on cpu) • Control & Status Registers • Generally not available to user programs • some used by CPU to control its operation • some used by OS to control program execution • User-Visible Registers • available to system (OS) and user programs • holds data, addresses, and some condition codes • 현재 실행중인 프로그램의 모든 상태 정보를 저장한다 신라대학교 컴퓨터공학과 - 운영체제

  10. Examples of Control & Status Registers • Program Counter (PC) • 다음에 수행한 명령어의 주소를 저장 • Instruction Register (IR) • 지금 수행중인 명령어를 저장 • Program Status Word (PSW) • 다음의 내용을 포함하는 레지스터 그룹: • condition codes and status info bits • Interrupt enable/disable bit • Supervisor(OS)/user mode bit 신라대학교 컴퓨터공학과 - 운영체제

  11. User-Visible Registers • Data Registers • 연산하기 위한 데이터나 중간 계산 결과를 저장하는 레지스터 • Address Registers • 데이터와 명령어의 메모리 주소를 저장 • 인덱스 또는 오프셋 주소 등과 같이 절대 주소를 계산하기 위한 정보를 저장 신라대학교 컴퓨터공학과 - 운영체제

  12. The Basic Instruction Cycle • CPU는 다음에 수행한 명령어와 데이터를 가져온다(Fetch Cycle) • CPU는 가져온 명령어를 수행한다(Execution Cycle) • Program counter (PC) 는 다음에 수행할 명령어의 주소를 저장하고 있다 • PC 레지스터 값은 fetch cycle에서 자동적으로 증가한다 신라대학교 컴퓨터공학과 - 운영체제

  13. Then CPU must wait for I/O to complete! • WRITE 명령어에 의해 제어권이 I/O 프로그램으로 넘어간다 • I/O 프로그램은 입출력을 위해 I/O Module을 준비한다(4) • CPU 는 I/O 명령이 수행 완료될 때까지 기다린다(Idle Wait) • I/O 프로그램은 I/O 명령의 수행 결과를 알려준다 • CPU는 중단된 사용자 프로그램을 수행한다 신라대학교 컴퓨터공학과 - 운영체제

  14. Interrupts • I/O modules은 event(입출력 동작의 완료 여부 등)를 INTERRUPT을 통하여 CPU에 알린다 • CPU은 Interrupt Handler Routine (normally part of the OS)을 실행하여 Interrupt를 서비스한다 • Interrupt Processing Routine / Interrupt Vector Table 신라대학교 컴퓨터공학과 - 운영체제

  15. Instruction Cycle with Interrupts! • CPU 는 현재 실행중인 명령어를 완료하고 interrupt를 검사한다 • 만약 pending된 interrupts가 없으면, 현재 프로그램의 다음 명령어를 실행한다 • Pending된 interrupt가 있으면, 현재의 프로그램 실행을 중단하고 interrupt handle를 실행한다 신라대학교 컴퓨터공학과 - 운영체제

  16. Interrupt Handler • Interrupt의 특성을 결정하고 필요한 처리 동작을 수행하는 프로그램 • Interrupt가 발생하면 소프트웨어 방식 또는 하드웨어 방식으로 현재 수행중인 프로그램은 중단되고 interrupt handler가 실행된다 • Interrupt handler 수행이 완료되면 중단된 프로그램을 수행한다(resume) • 따라서, interrupt handler를 수행하기 전에 현재 수행중인 프로그램의 상태 정보를 저장하여야 한다(content of PC + PSW + registers + ...) 신라대학교 컴퓨터공학과 - 운영체제

  17. Simple Interrupt Processing 신라대학교 컴퓨터공학과 - 운영체제

  18. Interrupts improve CPU usage • I/O 프로그램은 I/O Module을 준비하고 I/O 명령을 전송한 후에 사용자 프로그램으로 되돌아 온다 • 사용자 프로그램은 I/O 동작이 일어나는 동안 실행을 계속한다(e.g: printing)- no waiting • I/O 동작이 종료되면 사용자 프로그램은 인터럽트되며, interrupt handler가 실행되어 interrupt를 서비스한다 • 사용자 프로그램 실행을 재개한다 신라대학교 컴퓨터공학과 - 운영체제

  19. Classes of Interrupts • I/O • signals normal completion of operation or error • Program Exception • overflows • try to execute illegal instruction • reference outside user’s memory space • Timer • preempts a program to perform another task • Hardware failure (e.g: memory parity error) 신라대학교 컴퓨터공학과 - 운영체제

  20. Multiple interrupts: sequential order • Disable interrupts during an interrupt • Interrupts remain pending until the processor enables interrupts • After interrupt handler routine completes, the processor checks for additional interrupts 신라대학교 컴퓨터공학과 - 운영체제

  21. Multiple Interrupts: priorities • Higher priority interrupts cause lower-priority interrupts to wait • Causes a lower-priority interrupt handler to be interrupted • Example: when input arrives from communication line, it needs to be absorbed quickly to make room for more input 신라대학교 컴퓨터공학과 - 운영체제

  22. Multiprogramming • 프로그램은 I/O 장치를통하여 입출력하는 동안 I/O 동작이 완료될 때까지 기다려야 한다 • 하나의 프로그램이 입출력을 기다리는 동안 CPU는 다른 프로그램을 실행할 수 있다 • Interrupts are mostly effective when a single CPU is shared among several concurrently active processes 신라대학교 컴퓨터공학과 - 운영체제

  23. 향상된 CPU 내부 구조 (a) A three-stage pipeline (b) A superscalar CPU 신라대학교 컴퓨터공학과 - 운영체제

  24. CPU Mode • CPU 동작 모드 • 커널 모드(Kernel Mode or Supervisor Mode) • CPU의 모든 명령어를 실행할 수 있음 • 하드웨어의 각 특성을 이용할 수 있음 • 운영체제는 하드웨어를 완벽하게 접근할 수 있도록 커널 모드에서 동작 • 사용자 모드(User Mode) • CPU의 일부 명령어만을 실행할 수 있음 • 하드웨어의 일부 특성 만을 접근할 수 있음 • 사용자 프로그램은 사용자 모드에서 실행 • PSW의 모드 비트 설정에 의해 CPU 모드 전환 • Trap 등의 명령어에 의해 PSW의 모드 비트를 수정 신라대학교 컴퓨터공학과 - 운영체제

  25. Memory Hierarchy (1) Capacity, Access time Cost per bit, Frequency of access Registers Main Memory Magnetic Disk (Secondary Memory) Magnetic Tape Optical Disk (Tertiary Memory) 신라대학교 컴퓨터공학과 - 운영체제

  26. Memory Hierarchy (2) Capacity, Access time Cost per bit, Frequency of access Registers Cache Main Memory Disk Cache Magnetic Disk Magnetic Tape Optical Disk 신라대학교 컴퓨터공학과 - 운영체제

  27. Cache Memory • Small cache of expensive but very fast memory interacting with slower but much larger memory • Invisible to OS and user programs but interact with other memory management hardware • Processor first checks if word referenced to is in cache • If not found in cache, a block of memory containing the word is moved to the cache 신라대학교 컴퓨터공학과 - 운영체제

  28. The Hit Ratio • Hit ratio = fraction of access where data is in cache • T1 = access time for fast memory • T2 = access time for slow memory • T2 >> T1 • When hit ratio is close to 1 the average access time is close to T1 신라대학교 컴퓨터공학과 - 운영체제

  29. Locality of Reference • Memory reference for both instruction and data tend to cluster over a long period of time • Example: once a loop is entered, there is frequent access to a small set of instructions • Hence: once a word gets referenced, it is likely that nearby words will get referenced often in the near future • Thus, the hit ratio will be close to 1 even for a small cache 신라대학교 컴퓨터공학과 - 운영체제

  30. Hard Disk Driver 구조 Structure of a disk drive 신라대학교 컴퓨터공학과 - 운영체제

  31. Disk Cache • A portion of main memory used as a buffer to temporarily to hold data for the disk • Locality of reference also applies here: once a record gets referenced, it is likely that nearby records will get referenced often in the near future • If a record referenced is not in the disk cache, the sector containing the record is moved into the disk cache • Read-ahead policy 신라대학교 컴퓨터공학과 - 운영체제

  32. MMU(Memory Management Unit) (1) • Multiprogramming 환경에서 메모리에 두 개 이상의 프로그램을 유지하기 위해서는 다음의 두 가지 문제점에 대한 선결을 요구 • 프로그램간, 그리고 커널과 프로그램간의 보호 • 메모리 재할당 처리  MMU 를 통하여 해결 • MMU(Memory Management Unit) • 프로그램 상의 가상 주소(virtual address)을 실제 메모리에 매핑하여 사용하는 물리 주소(physical address)로 변환하는 장치 • 대개의 경우 CPU 내부에 구현 • Multitasking & virtual memory 기능을 제공하기 위해서는 필수적으로 요구 신라대학교 컴퓨터공학과 - 운영체제

  33. MMU(Memory Management Unit) (2) One base-limit pair and two base-limit pairs 신라대학교 컴퓨터공학과 - 운영체제

  34. I/O Module Structure • Data to/from system bus are buffered in data register(s) • Status/Control register(s) holds • current status information • current control information from • I/O logic interacts with CPU via control bus • Contains logic specific to the interface of each device 신라대학교 컴퓨터공학과 - 운영체제

  35. I/O communication techniques • 3 techniques are possible for I/O operation • Programmed I/O • Does not use interrupts: CPU has to wait for completion of each I/O operation • Interrupt-driven I/O • CPU can execute code during I/O operation: it gets interrupted when I/O operation is done. • Direct Memory Access(DMA) • A block of data is transferred directly from/to memory without going through CPU 신라대학교 컴퓨터공학과 - 운영체제

  36. Programmed I/O • I/O module performs the action on behalf of the processor • But the I/O module does not interrupt the CPU when I/O is done • Processor is kept busy checking status of I/O module(polling) 신라대학교 컴퓨터공학과 - 운영체제

  37. Interrupt-Driven I/O • Processor is interrupted when I/O module ready to exchange data • Processor is free to do other work • No needless waiting • Consumes a lot of processor time because every word read or written passes through the processor 신라대학교 컴퓨터공학과 - 운영체제

  38. Interrupt-Driven I/O (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a) (b) 신라대학교 컴퓨터공학과 - 운영체제

  39. Direct Memory Access(DMA) • CPU issues request to a DMA module (separate module or incorporated into I/O module) • DMA module transfers a block of data directly to or from memory (without going through CPU) • An interrupt is sent when the task is complete • The CPU is only involved at the beginning and end of the transfer • The CPU is free to perform other tasks during data transfer 신라대학교 컴퓨터공학과 - 운영체제

  40. System Bus Structure of a large Pentium system 신라대학교 컴퓨터공학과 - 운영체제

More Related