/var/www/tistory/Yongbaldae
yongmin@kali: ~/blog$ ls posts
C (9)

시스템프로그래밍 중간정리(lect9)

processA program loaded in the memory. //컴파일해서 실행파일을 만들면 디스크에 저장되게 되는데 디스크에 저장되어 있는 상태에서는 실행파일 또는 프로그램이라고 부릅니다.process = body + process descriptorbody= code + data + stackprocess descriptor = pid(process identifier) + state + mm(메모리 위치) scheduler어느 한순간에 메모리를 보면, 프로세스가 하나만 떠서 실행되는 경우는 거의 없다.이때 각 프로세스를 어떤것부터 처리할 것인가를 scheduler라는 것이 결정해준다."current" is pointing to the current process runningwhen the..

시스템프로그래밍 중간정리(lect8)

Command Line Arguments사실 main함수에도 매개변수가 존재합니다.int main(int x, char *y[])이런 경우가 지금까지 자주봤던 main() 형태보다 좀 더 일반적인 형태입니다. 예시로$ ./ex2 f1 f2the system will passx: number of command line arguments // 예시의 경우로는 3개입니다. ./ex2 f1 f2y: command line argument // y는 포인터배열 입니다. 각 argument의 스트링의 주소가 들어갑니다. 위의 경우에는 y[0]에는 ./ex2 스트링의 주소가, y[1]에는 f1,y[2]에는 f2의 주소가 들어가고 y[3]에는 0이 들어갑니다.void main(int argc, char * argv[..

시스템프로그래밍 중간정리(lect7)

파일에는 여러가지 타입이 존재합니다. regular file, directory file, link file, device file, socket file 등등이 있지요. 그중에서 regular file은 data file이라고도 불립니다. 데이터를 포함하고 있다는 뜻이지요. regular file (data file) 은 text file, non-text file 두가지로 형태가 나뉩니다. text file은 아스키코드(또는 UNICODE) 캐릭터를 포함하고 있습니다. non-text file(이진파일)은 아스키코드를 포함하고 있지 않습니다. 대신에 소리파일(wav,mp3) 또는 사진파일(gif,jpg,mpeg)이나 프로그램파일(exe,elf)이 non-text file에 포함됩니다. little e..

시스템프로그래밍 중간정리(lect 6)

File system callsopen,read,write function 이 함수들을 사용하기 위해서는 다음과 같은 헤더파일들이 필요하다.•#include fcntl.h> // 파일 제어에 필요한 상수와 함수들을 정의합니다.•#include stat.h> // 파일의 상태에 관한 정보를 가져오는데 필요한 구조체와 함수를 정의합니다.•#include types.h> // 여러 가지 데이터 타입과 관련된 typedef 선언을 포함하고 있습니다•#include unistd.h> // POSIX (Portable Operating System Interface) 운영체제 API에 관한 많은 함수, 상수, 타입들을 정의하고 있습니다. int main(){   int x, y;   char buf[20];    ..