

사람이 이해할 수 있는 프로그래밍 언어로 작성된 Source Code를 컴퓨터(CPU)가 이해할 수 있는 기계어로 표현된 Object 파일로 변환
프로그램이 수행하고자 하는 작업이 프로그래밍 언어로 표현 됨
컴퓨터(CPU)가 이해할 수 있는 기계어로 구성된 파일
Relocatable Addresses(Relative Address)로 표현
Cross-compiler for different platforms 
What Can't Be Translated?
Rosetta can translate most Intel-based apps, including apps that contain just-in-time (JIT) compilers. However, Rosetta doesn't translate the following executables:
- Kernel extensions
- Virtual Machine apps that virtualize x86_64 computer platforms
Rosetta translates all x86_64 instructions, but it doesn't support the execution of some newer instruction sets and processor features, such as AVX, AVX2, and AVX512 vector instructions. If you include these newer instructions in your code, execute them only after verifying that they are available. For example, to determine if AVX512 vector instructions are available, use the sysctlbyname function to check the hw. optional.avx512f attribute.
번역할 수 없는 것은 무엇인가요?
Rosetta는 적시 컴파일러(JIT)가 포함된 앱을 포함하여 대부분의 인텔 기반 앱을 번역할 수 있습니다. 그러나 다음과 같은 실행 파일은 번역되지 않습니다.:
- Kernel 확장
- x86_64 컴퓨터 플랫폼을 가상화하는 가상 머신 앱
Rosetta는 모든 x86_64 명령어를 번역하지만 AVX, AVX2 및 AVX512 벡터 명령어와 같은 일부 최신 명령어 세트 및 프로세서 기능의 실행은 지원하지 않습니다. 이러한 최신 명령어를 코드에 포함할 경우 사용 가능한지 확인한 후에만 실행하세요. 예를 들어 AVX512 벡터 명령어를 사용할 수 있는지 확인하려면 sysctlbyname 함수를 사용하여 hw. optional.avx512f 속성을 확인합니다.
관련된 여러 Object 파일들과 라이브러리들을 연결하여, 메모리로 로드 될 수 있는 하나의 Executable로 변환
특정한 환경(OS)에서 수행될 수 있는 파일
프로세스로의 변환을 위한 Header, 작업 내용인 Text, 필요한 데이터인 Data를 포함
Absolute Addresses로 표현하여 심볼들의 주소가 절대값으로 표현됨
컴파일러와 링커는 결과물이 수행될 OS와 CPU에 따라 다른 형태의 파일을 만듦
Executable을 실제 메모리에 올려주는 역할을 담당하는 운영체제의 일부
동작과정
Runtime System은 응용 프로그램의 효율적인 실행을 지원하기 위해, 프로그램과 연결하여 상호 작용함
C Runtime System Program Execution

Process - Abstraction for
Process - Implemented with
프로세스는 디스크에 저장된 프로그램으로부터 변환되어 로딩됨


Process Execution in Xv6
Code: exec
Exec is the system call that creates the user part of an address space. It initializes the user part of an address space from a file stored in the file system. Exec (6610) opens the named binary path using namei (6623), which is explained in Chapter 6. Then, it reads the ELF header. Xv6 applications are described in the widely-used ELF format, defined in elf.h. An ELF binary consists of an ELF header, struct elfhdr (0905), followed by a sequence of program section headers, struct proghdr (0924). Each progh-dr describes a section of the application that must be loaded into memory; xv6 programs have only one program section header, but other systems might have separate sections for instructions and data.
New: 새 프로세스 생성
Running: 프로세스 실행중
Waiting: 프로세스가 특정 이벤트에 의해 대기중
(e.g., an I/O completion or reception of a signal)
Ready: 프로세스가 다시 프로세서 신호에 할당되기를 대기중
Terminated: 프로세스가 실행을 완료
커널 내에 Ready Queue, Waiting Queue, Running Queue를 두고 프로세스들을 상태에 따라 관리한다. 
Process State in Xv6
각 프로세스는 OS에서 PCB로 표시
각 프로세스에 관련한 정보들
- Process State
- Program Counter
- CPU Registers
- CPU Scheduling Information
- Memory Management Information ‒ Accounting Information
- I/O Status Information
CPU가 새로운 프로세스로의 전환을 할때, Kernel은 반드시
기존 프로세스 상태 저장(Save)한 후
새로운 프로세스 로드(Load)해야 함
Context Switching의 시간은 overhead임
Context Switching은 하드웨어의 지원에 의지
(ex. Intel Pentium Processor)
Register Window (Berkeley RISC Desigm) 




프로세스들은 Concurrently 하게 실행될 수 있으며, 동적으로 생성/종료 됨
OS provides process creation and process termination mechanisms
Process Creation (ex. fork( ))
- Parent process vs. Child process
- Resource Sharing
Parent and children share all resources.
Children share subset of parent’s resource.
Parent and child share no resource.
- Execution
Parent and children execute concurrently. ‒ Parent waits until children terminate.
자식 프로세스는 부모 프로세스의 복제본
자식 프로세스에는 프로그램이 Load되어 있음
ex) Unix
- fork System call로 생성된 새 프로세스.
- 새 프로세스(자식 프로세스)는 원래 프로세스(부모 프로세스)의 메모리 복사본
- Exec(2): 메모리를 새 프로그램으로 교체합니다.



프로세스는 최종문 실행이 끝나면 종료되며 exit System Call을 사용하여 운영체제에 삭제를 요청
abort function은 비정상적인 프로세스 종료를 일으킴
독립 프로세스는 다른 프로세스의 실행에 영향을 주거나 영향을 받을 수 없습니다.
