Operating System/O.S(Arif Butt)

Basic Shell Command (Lec06, Lec07)

Tony Lim 2021. 1. 1. 21:37
728x90

exporting user defined variable to sub shell

 

preprocessor == include headerfile, expand macro , remove comments , generate modfied source program. gcc -E only preprocess

compiler == generate assembly program. 

1. check for syntax error

2. converts source to assembly of underlying processor(x86)

Assembler == generate relocatable object program. assemble to machine depend code. 

Linker == combine all the locatable object file. e.g) printf.o which is C standard libaray

gcc hello.c  == generate executable object program

 

Types of object files

1. executable object file == a.out

2. relocatable object file == xxx.o , non-linked object file

3. shared object file == special type of relocatable object file, DLL 

4. core file == when terminate happens process generate core file 

 

Formets of Object files

1. a.out == initial version of unix

2. COFF == common object file format // SVR3 UNIX

3. PE == portable executable format // Window 

4. ELF == executable and linkable format//  SVRh, Linux

 

ELF Header == data that are used for linking 

Program header table == 

.text == machine code

.rodata == read only data

.data == initialize global, static variable

.bss == unintitialize global variable , block starting symbol   

symbol table , highlight part is symbol of printf

 

Process in Linux

loading a program from disk to memory

process == instance of program running on a computer

Process Control Block(PCB)

1. process identification == PID(id of process) PPID(parent id of process) ,SID( Session id of process) 

2. process state information 

3. process control information

pictorial view of process

 

728x90