프로세스별 번호 탐색
read(3, ...)의 3은 현재 프로세스 fd table index다.
fd 3은 파일 자체가 아니라 프로세스 테이블의 작은 정수 인덱스다. 그 뒤에는 open file description과 inode, file offset, flags가 연결된다.
read(3, ...)의 3은 현재 프로세스 fd table index다.
dup이나 fork 뒤 두 fd가 같은 open file description을 가리키면 file offset도 공유된다.
fd를 닫지 않으면 파일, pipe, socket 자원이 남고 EOF 전달도 지연될 수 있다.
process fd table[3] -> open file description(offset, flags) -> inode -> disk blocks