Operating System Ch 12

LeemHyungJun·2022년 12월 10일
0

Operating System

목록 보기
14/14
post-thumbnail

운영체제 수업 + Operating System Concepts 10E 정리 내용

Operating System Ch12 : I/O Systems

Computer System Operations

IO Hardware

1. Overview

  • CPU가 IO 장치에게 명령을 내리는 방법
    • hardware 디펜던시가 높은 작업
    • Direct I/O : 레지스터 번호당 특정 io 장치가 직접 연결하는 방식
    • Memory mapped I/O : 레지스터 대신에 메모리 공간에 직접 맵핑하는 방식
  • io controller
    • io와 CPU가 정보를 주고받는데 도움을 주는 장치
    • IR (Instruction Register), DR (Data Register) 포함
  • I/O Method
    • programmed io
      • io 장치에서 처리한 결과를 CPU 레지스터에 직접 전달하는 방식
      • ex) 키보드나 마우스 input
    • Interrupt
    • DMA
      • 처리할 io의 양이 큰 경우 CPU를 거치지 않고 바로 메모리로 올리는 방식

2. Direct I/O

  • 메모리 디바이스와 io 디바이스를 따로 생각하는 방식
  • 각각 다른 명령어를 사용한다.
  • 장점 : isolation 가능. ex) intel
  • 단점 : hardware가 복잡하고 중복된 instruction이 된다.

3. Memory-Mapped I/O

  • 메모리 디바이스와 io디바이스를 합쳐서 생각하는 방식
  • 메모리의 특정 영역을 io controller와 맵핑시켜서 지정된 메모리 영역에 무언가를 쓰면 io controller에도 같이 써지는 방식
  • direct io 방식의 단점을 극복
  • 장점 : 구조가 간단해진다. ex) ARM, Embedded system

4. A Typical PC Bus Structure

  • 빠르게 처리해야하는 것은 PCI bus를 사용
  • 빠르지 않아도 되는 것은 expansion bus 사용

5. Device Controller

  • 하는 일
    • 외부에서 연결한 IO 디바이스와 CPU를 연결해 주는 역할
    • convert setial bit stream to block of bytes
    • perform error correcting
    • make available to main memory
  • io device's components
    • Mechanical Component
    • Electronic Component
      • handle multiple devices

6. I/O Performance of Storage and Network Latency

IO Software

1. Kernel I/O Structure

  • hardware : 맨 아래쪽에 존재하는 io 장치 + device controller
  • software : driver + kernel subsystem + kernel
    • driver
      • kernel과 연결시켜주는 역할을 하거나 성능을 높여주는 역할을 한다.
      • hardware dependent 하다
    • kernel io subsystem
      • 전체적으로 통합해서 관리하는 general한 방식
      • 표준화

2. Life Cycle of An I/O Request

  • user land = application

  • 순서
    1) 커널에 io 요청
    2) 커널 io subsystem이 확인

    2-1) buffer cache 처리 가능 : 바로 io 수행 후 시스템 콜에서 복귀
    2-2) buffer cache 처리 불가능 : 3)으로 진행

    3) device driver : 요청 처리, 컨트롤러에 명령 내림
    4) device controller : 명령감시 후, 장치 실행
    5) interrupt: io 완료후 interrupt 발생
    6) interrupt handler : 인터럽트 수신

3. Device-Functionality Progression

  • io 시스템이 다 갖춰진 상태에서 새로운 알고리즘을 추가해야 할 때 어디에 구현하는 것이 효율적인지에 대한 문제
  • 아래로 내려갈수록 hardware로 구축
    • 장점: 좋은 효율, abstraction
    • 단점: 개발 기간이 길어지고 비싸짐, 유연성이 떨어짐
  • 위로 갈수록 software로 구축
    • 장점: 유연성이 좋아짐
    • 단점: 느리고 효율이 떨어짐
  • trade off를 따져서 선택해야 한다.

4. Goals of IO Software

  • Device independence
  • Uniform naming
  • Error handling
  • Synchronous vs Asynchronous
  • Buffering
  • Sharable vs dedeicated devices

5. IO Software Layers

6. Interrupt Handlers

7. Device Drivers

  • device-independent한 IO software와 interrupt handler와 상호 작용하는 IO 장치를 control하는 device-specific 한 코드
  • implementing
    • statically linked with the kernel
    • selectively loaded into the system during boot time
    • dynamically loaded into the system during execution

8. Device-Independent I/O Software

1. Buffering

  • 임시로 데이터를 저장하는 것
  • Buffering 방식

    a) 사용 안하기
    b) user space에 하기
    c) kernel에 하기
    d) kernel에 두번 하기
  • c,d의 경우 OS가 관리해주기 때문에 성능은 좋지만, kernel이 메모리를 많이 써야한다는 단점이 존재한다.

2. Error reporting

  • 적합한 driver에 맞게 error handling 해주어야 한다.
  • programming error VS actual IO error
  • handling errors -> cpu dependent 하다
    • retrying a certain number of times : ex) 통신 요청
    • ignoring the error
    • killing the calling process

3. Allocating and releasing dedicated devices

  • 특정 디바이스는 share 할 수 없다.

4. Device-independent block size

  • 몇 개의 sector를 하나의 logical 한 block으로 처리

9. User-Space I/O Software

  • Spooling
    • buffering(주기억 장치를 버퍼로)과 유사한 동작
    • application에서 file로 buffering 하는 방식
    • 멀티 프로그래밍 환경에서 다수 프로세스가 입출력 장치를 요구할 때 사용
    • ex) 프린터

IO System Layers

0개의 댓글