LinuxUNIX Programming APUE Introduction IT LinuxUnix APUE Introduction

















- Slides: 17

Linux/UNIX Programming APUE (Introduction) 문양세 강원대학교 IT대학 컴퓨터과학전공



Linux/Unix 시스템 구조 APUE (Introduction) Hardware • CPU, Memory, Disk, Peripherals Kernel • Process Management • File Management • Memory Management • Device management System Call • The programmer's functional interface to the Linux/Unix kernel Commands, Utilities, Application programs • Kernel services using library routines or system calls Page 4 UNIX System Programming by Yang-Sae Moon

시스템 호출 (System Calls) (1/2) Process APUE (Introduction) Process System call interface File Management IPC Page 5 Process Management UNIX System Programming by Yang-Sae Moon

시스템 호출 (System Calls) (2/2) APUE (Introduction) Application programs talk to the operating systems via system calls. The programmer's functional interface to the Linux/UNIX kernel. Page 6 UNIX System Programming by Yang-Sae Moon

User Mode vs. Kernal APUE (Introduction) Kernel User process Address of kernel close() Address of kernel open() result=open(“file. txt”, O_RDONLY); Address of kernel write() User code open(char *name, int mode) { <Place parameters in registers> <Execute trap instruction, kernel code for open() switching to kernel code > { <Manipulate kernel data> <Return result of system call> . . . } <Return to user code> C runtime } library Page 7 Kernel system call code UNIX System Programming by Yang-Sae Moon

System Calls & Library Functions (1/2) APUE (Introduction) System Calls • Well defined entry points directly into the kernel • Documented in the Linux/Unix man pages • Look like C functions which can be called from a user's program – just need to include the appropriate header • 예) read(), write() Library Functions • The library function is often more elaborate than the system call, and usually invokes the system call (System call 보다는 좀 더 사용하기 쉽고 편리하게 제작) • 예) fprintf(), fscanf() Page 8 UNIX System Programming by Yang-Sae Moon

System Calls & Library Functions (2/2) APUE (Introduction) application code user process C library functions system calls kernel hardware (hard disk…) Page 9 UNIX System Programming by Yang-Sae Moon

C I/O Library Functions APUE (Introduction) 표준 입력 함수 (standard input function) • scanf(), getchar() 표준 출력 함수 (standard output function) • printf(), putchar() 표준 파일 입력 함수 • fscanf(), fgets(), fgetc() 표준 파일 출력 함수 • fprintf(), fputs(), fputc() Page 10 UNIX System Programming by Yang-Sae Moon



파일 출력 예제 (fgets. c) (1/2) Page 13 APUE (Introduction) UNIX System Programming by Yang-Sae Moon

파일 출력 예제 (fgets. c) (2/2) Page 14 APUE (Introduction) UNIX System Programming by Yang-Sae Moon

파일 입출력 예제 (fcopy. c) (1/2) Page 15 APUE (Introduction) UNIX System Programming by Yang-Sae Moon

파일 입출력 예제 (fcopy. c) (2/2) Page 16 APUE (Introduction) UNIX System Programming by Yang-Sae Moon

시스템 프로그래밍 준비 에디터 APUE (Introduction) We already knew “vi”. 컴파일러 We may use “cc” or “gcc” 디버거 You should learn either “gdb” or “dbx”. make We already learned about “make” and “Makefile”. Page 17 UNIX System Programming by Yang-Sae Moon
Linuxunix
Apue
Apue
Apue
Apue
Perbedaan linear programming dan integer programming
Greedy programming vs dynamic programming
What is system programming
Integer programming vs linear programming
Definisi integer
Introduction to server side programming
Java introduction to problem solving and programming
Introduction to programming languages
Daniel liang introduction to java programming
An introduction to parallel programming peter pacheco
Introduction to visual basic programming
Plc stand for
Java introduction to problem solving and programming