본문 바로가기
CS/Computer

프로그램에 관하여

by JiGyeong 2019. 5. 14.

1. 프로그램 실행

OS에게 메모리에 Program 얹어서 Process화 하는 것

2. OS Layer

  • Kernel

    1. Driver (그래픽 카드, Network 라우터, HDD, SDD, SDCard, Sound 장치 등)
    2. Process (PS ID, Memory 할당, PS 상태관리)
      Ready 상태에서 CPU 할당될 때 실행 상태로 바뀜, I/O로 넘어가기 전에 Ready로 변경된 뒤 넘어감 ( Interrupt로 관리 )
    3. Memory
    4. Interrupt (System Call)
      (마우스 움직일 때 Interrupt, 실행되던 프로세스를 ready 상태로 바꿔준 뒤 마우스 프로세스로 바꿔줌)
    5. 리눅스는 Driver를 Module화 해서 사용함.
  • System Library ( Kernel에 바로 들어갈 수 없으니 lib사용 )

    1. Static Library : Build 할 때 미리 할당
    2. Dynamic Library : 실행할 때 메모리 할당 ( .dll (프린트, ssl 등 ) 파일이 해당), 두 번째 사용시 적재된 lib 사용
  • User Library (솔루션 lib 등)

  • Shell - GUI (탐색기), CLI(Command Line Interface : cmd 등)

  • Application

3. (바이너리) 프로그램 구조

(ex : prinf("hello"))

  • 헤더 정보 : OS 인식을 위한 헤더 정보
  • DATA : "hello"(상수)
  • TEXT : 기계어 --> 메모리에 다 올린 후(Loading), CPU 할당받으면 기계어 실행, 결과값 저장
  • 외부참조 : dll 등 찾기 위한 주소(Linking)
    (Linking Loader : 외부 라이브러리 참조)

4. 인터프리터

파이썬 인터프리터 자체가 실행파일 임 (node js, VM 등)
-> 그래서 윈도우, 리눅스 용이 따로 있다.
-> 스크립트는 호환이 가능하다.

'CS > Computer' 카테고리의 다른 글

Operating System  (0) 2019.06.07
Data In Digital  (0) 2019.05.17
DLL (Dynamic Link Library)  (0) 2019.05.07
RPA (Robotic Process Automation)  (0) 2019.04.24
Hash Collision, 해시 충돌시 해결방법  (0) 2019.04.18