udada
Daisy on April
udada
전체 방문자
오늘
어제
  • 분류 전체보기 (51)
    • Computer Science (19)
      • 웹(Web) (0)
      • SQL (0)
      • 개발자 공부(Developer) (13)
      • 코딩테스트 (5)
    • 소프트웨어 전공 (12)
      • 알고리즘 개론 (0)
      • 컴퓨터 구조 개론 (3)
      • 프로그래밍 언어 (0)
      • 시스템 프로그램 (6)
      • 시스템 프로그래밍 실습 (3)
      • 자바 프로그래밍 실습 (0)
      • 웹 프로그래밍 실습 (0)
    • 스파르타코딩클럽 (0)
      • 웹개발 (0)
    • 프로젝트 (0)
      • URP 프로젝트 (0)
      • ICT 한이음 프로젝트 (0)
      • [CloneCoding] Twitter (0)
    • 경력 (0)
      • IBK 기업은행 (0)
    • News (4)
      • Tech News (3)
      • 경제 신문 스크랩 (0)
    • 독서 (1)
    • 기타 (0)
    • English Expression (9)
    • Motion Graphic (1)
    • Metaverse (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • CSS
  • sql #rdbms
  • 영어표현
  • metaverse
  • 자물쇠효과
  • 메타버스
  • 아이폰과갤럭시
  • front-end
  • query
  • SQL
  • web-dev
  • RDBMS
  • 관계형데이터베이스
  • DigitalWallet
  • HTML
  • 웹개발
  • 프론트엔드
  • 쿼리
  • ComputerScience
  • javascripts

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
udada

Daisy on April

[System Program] [5] Exceptions and Processes
소프트웨어 전공/시스템 프로그램

[System Program] [5] Exceptions and Processes

2021. 5. 30. 17:23

> Control flow (제어 흐름)

# 프로세서는 한 번에 하나의 instruction을 실행한다. 

시작부터 끝까지, CPU는 일련의 instuction들을 하나씩 읽고 처리한다. 

-> CPU's control flow; 프로그램에서 실행되는 각 구문, 명령어나 함수가 호출되는 순서

 

> Altering the Control Flow

순차적으로 진행되는 제어 흐름의 변화를 일으키는 요인

 

# program state를 변화시키는 요소

  • Jumps and branches
  • Call and return

# system state를 변화시키는 요소 -> exceptional control flow 발생

  • Data arrives from a disk or a network adapter
  • Instruction divides by zero
  • Ctrl+C를 통한 프로시져 종료
  • system timer expires

> Exceptional Control Flow (ECF)

모든 단계의 computer system에 존재한다. 

# Low level mechanism - Exceptions

Exception; 이벤트에 대해 OS kernel에 제어를 전송

** kernel;  컴퓨터의 운영 체제(OS)의 핵심이 되는 컴퓨터 프로그램으로, 시스템의 모든 것을 통제하고, 응용 프로그램 수행에 필요한 서비스를 제공한다. 

 

# High level mechanism - Process context switch/ Signals/ Nonlocal jumps

 

> Asynchronous Exceptions (비동기식 인터럽트) => Interrupt

# 정해진 기준없이 예측 불가능하게 이벤트 발생

# 다른 하드웨어 장비가 CPU와 상관없이 발생시킴

# Example: Timer interrupt/ I/O interrupt form external device

 

> Synchronous Exceptions (동기식 인터럽트) => Exception

# 이벤트가 예측 불가능하게 발생하는 것이 아니라 기준에 맞추어 또는 시간에 맞추어 수행시키는 것을 의미

# 내부적으로 CPU control unit이 명령어의 실행결과로 자주 발생시킴

(Intel CPU에서 사용되는 exception의 분류)

# trap: INT 명령으로 명시적 발생

  • Intentional
  • Examples: system calls, breakpoint traps, special instructions
  • Returns control to “next” instruction

# fault: 0으로 나눈 에러

  • Unintentional but possibly recoverable
  • Examples: page faults (recoverable), protection faults (unrecoverable), floating point exceptions
  • Either re-executes faulting (“current”) instruction or aborts

# abort: 복구 불가능한 에러

  • Unintentional and unrecoverable
  • Examples: illegal instruction, parity error, machine check
  • Aborts current program

> Processes

# Process; 프로그램(program)의 인스턴스(instance)

# 2개의 key abstractions

  • logical control flow; 각 프로그램에 프로세서를 혼자 사용한다는 착각을 제공 -> context switching
  • private address space; 각 프로그램에 메모리를 혼자 사용한다는 착각(각 프로그램에 할당된 사적 주소공간의 메모리는 다른 프로세서가 읽거나 쓸 수 없다) -> virtual memory

> Multiprocessing

# The Traditional Reality 

단일 프로세서가 여러 프로세스를 동시에 실행한다. 

# The Modern Reality -> multicore processors

> Concurrent Processees ( 동시성 흐름 )

동시성 흐름이란, 동시에 실행된다는 개념보다는 다른 논리 흐름과 실행시간이 겹치는 흐름을 의미한다. 

> Context Switching ( 문맥 전환 )

커널은 문맥 전환(context switch)을 통해 멀티태스킹을 구현

** 문맥(context)은 커널이 선점된 프로세스를 다시 시작하기 위해 필요로 하는 일종의 상태

> System Call Error Handling

# return -1

# set global variable errno to indicate cause

 

> Creating Processes

fork를 통해 부모 프로세스는 자식 프로세스를 생성

# int fork(void)

자식 프로세스에게는 0을 반환하고, 부모 프로세스에게는 자식의 PID를 반환한다. 

  • call once, return twice
  • concurrent execution (동시에 실행); 실행 순서를 예측할 수 없다.
  • 주소 공간을 복제 BUT 개별적으로 분리 
  • Shared open files

 

'소프트웨어 전공 > 시스템 프로그램' 카테고리의 다른 글

[System Program] [7] [Virtual Memory]  (0) 2021.05.31
[System Program] [9] Concurrent Programming  (0) 2021.05.31
[System Program] [4] Cache Memory  (0) 2021.05.30
[System Program] [3] Memory Hierarchy  (0) 2021.05.29
[System Program] [1] Data Presentation  (0) 2021.05.25
    '소프트웨어 전공/시스템 프로그램' 카테고리의 다른 글
    • [System Program] [7] [Virtual Memory]
    • [System Program] [9] Concurrent Programming
    • [System Program] [4] Cache Memory
    • [System Program] [3] Memory Hierarchy
    udada
    udada

    티스토리툴바