Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 윤성우의 열혈 자료구조
- 윤성우 열혈자료구조
- Algorithm
- C programming
- Selection Sorting
- list 컬렉션
- Graph
- buffer
- Serialization
- R
- JSON
- 메모리구조
- 이것이 자바다
- datastructure
- Stack
- C 언어 코딩 도장
- 혼자 공부하는 C언어
- 알기쉬운 알고리즘
- stream
- coding test
- s
- insertion sort
- 이스케이프 문자
Archives
- Today
- Total
Engineering Note
4. System Software & Program Execution 본문
Computer Science/System Software
4. System Software & Program Execution
Software Engineer Kim 2021. 1. 20. 23:04시스템 소프트웨어
KOCW 이화여대 시스템소프트웨어(반효경)
4. System Software & Program Execution - 고급언어, 컴파일러, 링커, 로더, 어셈블러, 라이브러리
학습내용 : 고급언어로 작성된 프로그램이 실행파일로 만들어져 실행 될 때 까지의 과정
Program Execuion 을 위한 System Software
컴파일러
: 고급언어 프로그램(source file)(시스템의 종류에 무관) -> 어셈블리 프로그램(시스템에 따라 다름)어셈블러
: 어셈블리언어 프로그램(Ex. MIPS) -> 기계어 프로그램(object file)링커
: 여러 object file 및 library file을 하나의 executable file로 만듦로더
: executable file 또는 object file을 메모리로 올림- 상용컴파일러 소프트웨어(gcc, visuzl c)가 컴파일러, 어셈블러, 링커, 등을 내포하고 있어 소스파일에 서 실행파일 변환이 한번에 이루어짐
- 로더 기능은 유닉스, 윈도우 등의 운영체제에 포함되어 수행
Program Language
고급언어(high level language)
- 인간이 이해하기 가장 쉬운 언어, machine independent
- machine language / assembly language로 변환 시켜주는 SW 필요(compiler, interpreter)
- ex) BASIC, C, JAVA, C++, FORTRAN, COBOL
어셈블리언어(Assembly language)
- 0과 1의 조합을 상징적인 코드로 변환하여 인간의 이해도를 향상
- machine language와 1대1 맾이, mahine dependent
기계어(machine language)
- 컴퓨터가 직접이해 가능한 언어, machine dependent
- 0과 1의 조합
- compiler와 interpreter 차이
- compiler컴파일시 기계어가 포함된 실행파일을 만든다.
- interpreter는 기계어로 바로 만드는 것이 아니고 고급언어 실행중에 기계어로 바꾸면서 실행
Seperate Compile
- static : 해당파일 안에서만 볼 수 있다는 의미
- 분할 컴파일 시 동일 변수명을 사용할 경우 오류 발생 없앰
- 함수 return 후에도 함수 내에 선언된 변수가 정보가 기억되어 사용할 수 있도록(해당 파일 어디서라도)
- ex) static 전역변수, static 지역변수
- extern : 변수 선언이 다른 소스파일에 되어 있다는 것을 알려주는 역할
- Seperate compile : symbol(변수, 함수 등의 이름을 말함)의 위치 불명확 type 만 파악 -> "object file" (*.o *.obj)
- Linking : 오브젝트 파일들과 라이브러리 파일을 링커가 실행파일로 변환함, symbol의 위치 명확 -> "executable file"(a.out or *.exe)
Static Linking vs Dynamic lInking
- static linking
- 라이브러리가 프로그램의 실행파일 코드에 포함됨(static library)
- 실행파일의 크기가 커짐
- 동일한 라이브러리를 각각의 프로세스가 메모리에 로드됨으로 메모리낭비(ex: printf 함수의 라이브러리 코드)
- Dynamic linking
- 라이브러리가 실행시 link됨(shared library)
- 실행파일에는 라이브러리 자체가 포함되는 것이 아니라 라이브러리의 위치를 찾기위한 간다한 코드만 있음
- 라이브러리가 이미메모리에 있으면 그 루틴의 주소로 가고 없으면 디스크에서 읽어줌
Static library vs Shared Library
- static library
- functions are copied into a.out during gcc time
- binding : compile time(실행 파일이 만들어질 때)
- 컴파일 한다음 링크 했을 때 실행 파일안에 라이브러리 코드가 이미 포함 되어 있는 방식
- default linking L/lib/libc.a
- shared library
- functions are not copied during gcc time (just map)
- During the run, load on demand from library(shared)
- binding :run time
- 실행파일이 만들고 나서도 코드에 포함되지 않고 단지 라이브러리 파일이 어디있는지 위치만 확인하고 실행파일이 실행될때 라이브러리함수를 만나면 라이브러리 파일 포함 되는 방법
Shared Library
- Advantage of shared library
- many processes share one library function in memory. ex) many a.out's calls printf() - one copy shared
- less memory space
- Disadvantage of shared library
- Cannot give a.out to who do not have library!
- Do they have shared library files? Same version?
- Slower(for lib calls, bind and load at the run time)
- heavy overhead in initial bookeeping during gcc
'Computer Science > System Software' 카테고리의 다른 글
(7.1) 리눅스환경의프로그램실행 I - gcc, library (0) | 2021.07.15 |
---|---|
Shell (0) | 2021.07.13 |
링커와 로더 (0) | 2021.05.02 |
5.0 유닉스 및 리눅스 소개 (0) | 2021.01.22 |
Garbage Collection 알고리즘 종류 (0) | 2021.01.19 |
Comments