HW & SW Interface
-
5. File I/O - system calls(1)HW & SW Interface/System Programming 2020. 5. 5. 20:07
# File I/O review 파일 관련 시스템 프로그래밍을 위한 system calls과 library calls의 관련 함수는 다음과 같으며, 이번 포스팅에서는 system calls을 집중적으로 볼 것이다. System Calls for File descriptor I/O - open(); close(); creat(); read(); write(); - seek(); - fcntl(); Library Calls for File I/O (File stream) - fopen(); freopen(); fclose(); fread(); fwrite(); - fgetc(); fgetchar(); fputc(), putchar(); - fseek(); fprintf(); fscanf(); # Linux ..
-
4. File I/O - library calls(3)HW & SW Interface/System Programming 2020. 5. 5. 16:52
# File offset 모든 파일은 read/write offset을 가지고 있으며, File offset은 해당 파일을 열었을 때 읽거나 쓸 시작 위치를 말한다. 파일을 읽거나 쓸때, 현재 offset의 위치를 그대로 사용하는 것을 sequential access라 하고, offset의 위치를 변경해서 사용하는 것을 random access라 한다. # Random access r/w offset을 변경하기위해 제공되는 함수(library calls)는 다음과 같다. 파일의 offset 위치 변경 int fseek(FILE *stream, long offset, int sopt) parameters stream: offset을 변경할 파일의 포인터 offset: SEEK options에 따른 offs..
-
3. File I/O - library calls(2)HW & SW Interface/System Programming 2020. 5. 5. 15:48
# File Open filename의 파일을 type 모드로 열기 #include File *fopen(const char *filename, const char *type); parameters filename: 파일 이름 (string) type: 파일 접근 모드 type 의미 r read-only w write/ 파일이 존재하면 덮어쓰고, 존재하지 않으면 생성 a append mode(EOF), write-only/ 파일 존재하지 않으면 생성 r+ read + write w+ read + write/ 파일이 존재하면 덮어쓰고, 존재하지 않으면 생성 a+ read/append mode(EOF)/ 파일 존재하지 않으면 생성 return 성공 -> file stream pointer 실패 -> NULL..
-
2. File I/O - library calls(1)HW & SW Interface/System Programming 2020. 5. 5. 00:57
# File I/O review 파일 관련 시스템 프로그래밍을 위한 system calls과 library calls을 알아볼 것이다. 각각의 calls 관련 함수는 다음과 같으며 이번 포스팅에서는 library calls을 집중적으로 볼 것이다. System Calls for File descriptor I/O - open(); close(); creat(); read(); write(); - seek(); - fcntl(); Library Calls for File I/O (File stream) - fopen(); freopen(); fclose(); fread(); fwrite(); - fgetc(); fgetchar(); fputc(), putchar(); - fseek(); fprintf();..
-
1. IntroductionHW & SW Interface/System Programming 2020. 5. 4. 23:19
# Computer System 전반적인 컴퓨터 시스템의 구조는 다음과 같으며, 시스템 프로그래밍이란 System calls을 어떻게 사용(활용)할 것인지에 관한 것이다. 여러 운영체제 중(Windows, Linux, Mac os ..) Linux를 기반의 System Calls을 살펴볼 예정이며, 다음은 위 그림에서 software 부분(Linux 기반)을 계층적으로 나타낸 것이다. 바깥쪽에 위치할 수록 user level에 가까운 것이다. System calls은 프로그래머가 커널과 소통하기 위한 기능적인 인터페이스로, 이를 통해 커널의 다양한 영역들을 효율적으로 활용할 수 있다. 여기서 커널의 다양한 영역이란 Process/ File/ Memory/ Device 등의 관리를 뜻한다. # System..