일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 프로그래머스
- 수학
- 파이썬
- 가상메모리 관리
- level2
- 다이나믹 프로그래밍
- N과M
- 가상메모리
- BOJ
- python
- level3
- programmers
- level0
- 재귀
- BFS
- level1
- 그리디
- 백준
- dict
- 구현
- 딕셔너리
- DP
- 브루트포스
- 힙
- 운영체제
- 스택
- 다익스트라
- MYSQL
- 코딩테스트
- dfs
- Today
- Total
목록CS/시스템프로그래밍 (13)
동캄의 코딩도장
Files in Unix/Linux Regular file(-) Special (device) files - Character device file (c) - Block device file (b) Directory (d) symbolic link file(l) Special file 장치와 데이터를 주고 받는 통로 - 데이터 블록이 없음 - 장치 번호를 incode에 저장 Character device file(c) - Character 단위로 데이터 전송 Block device file (b) - block 다위로 데이터를 전송하는 장치 File organization File name (hard link) -사용자가 파일에 접근 할 때 사용 inode - 파일에 대한 정보를 저장 - 번호를 통해 관..
Handling file offset #include int fseek (FILE * stream, long offset, int whence); long ftell (FILE * stream); void rewind (FILE *stream); int fsetpos (FILE * stream, const fpos_t *pos); int fgetpos (FILE *stream, fpos_t *pos); stream offset: 이동시킬 byte의 수 (양수 or 음수) whnce: 기준 위치 (SEEK_SET, SEEK_CUR, SEEK_END) pos: offset을 저장 할 (or 하고있는) fpos_t 주소 Return -> Man page 참조 File Pointer File Descriptor..
Ascii(text) file -사람이 바로 읽을 수 있음 - 데이터 저장 및 사용 시, 문자로 (or 문제에서) 변환 과정이 필요함 --> 많은 양의 데이터 처리에 비효율적 --> 동일한 데이터를 저장하는 이진 파일대비 많은 공간을 요구함 Binary file - 컴퓨터가 바로 사용할 수 있는 형태(메모리에 저장된 형태 그대로 저장) --> 별도의 변화 과정 없이 읽기/쓰기 가능 ---> 데이터 처리에 효율적이며, 저장 공간을 효율적으로 사용 할 수 있음 - 사람이 읽을 수 없는 형태--> 데이터 교환 시 약속(protocol)이 필요함 Binary File Binary I/O FILE *fopen (cont char *name, const char *mode) mode - "rb", "wb", "ab..
Character-based reading #include int fgetc (FILE * stream); int getc (FILE * stream); int getchar (void); stream: File operation을 수행할 stream c (character): 쓰려는 문자 Return: 읽은/기록한 문자 | EOF(-1) : error Character-based reading #icclude int fputc (int c, FILE *stream); int putc (int c, FILE *stream); int putchar(int c); stream: File operation을 수행 할 stream c(character): 쓰려는 문자 Return - 읽은/기록한 문자 | EOF..
Standard IO - A platform-independent, user-buffering solution File pointer - File operation을 관리하는 구조체(FILE)을 가리키는 포인터 - 내부적으로 file descriptor와 연동(mapping)됨 Stream - 프로그램과 file을 연결한 통로 Workflow of file I/O File open -> File access (Read/ Write) -> File close FIle open (Opening a file/stream) #include FILE *fopen (const char *path, const char *mode); path (file path) - 열려는 파일의 경로 mode (file open m..
High-Level File IO (Buffered IO) Disk address physical disk address - sector(물리적 데이터 전송 단위)를 지정 Logical disk address: relative address - Disk system의 데이터 전체를 block들의 나열로 취급 (block에 번호 부여, 임의의 block에 접근) - Block 번호 -> physical address 모듈 필요 (disk driver) Block - An abstraction of the file system - 운영체제(예, linux) 입장에서 file system은 block들의 나열 - 512~8192 byte(2^n) - Disk (or block device) access의 최소..