# **SP_CH3** UnBuffered I/O
## **UNIX Standardlization**
> ### **ANSI C**:
>> - Provide **portability** of conforming C programs to a wide variety of OS’s
>> - Associated with **Function Call**
>> - Ex: stdio.h, stdlib.h, ...
> ### **POSIX**:
>> - Define the application programming interface for software **compatible** with variants of OS’s
>> - Associated with **System Call**
>> - Ex: unistd.h(unix std), pwd.h, ...
## **UnBuffered I/O**
> - Each read() and write() invokes a system call in the kernel
> - Buffer cache: cache of recently used disk blocks
It’s not necessary to trigger disk I/O for unbuffered I/O
## **What is 'UnBuffered' refer to?**
> 
> - **Buffer**:
>> 1. Buffer in user’s process is provided by the **C standard library**.
> >2. Buffer cache is provided by the **operating system**
> - Unbuffered I/O: **No Buffer provided by *C standard library***
## **File Descriptor** (file desc.)
> - **Non-negative integer** returned by open() or creat(): 0 .. OPEN_MAX (Max number of file OS can open)
> - Referenced by **Kernel**
> - Per-Process Based
## **File I/O: open(), openat()**
> - int open(const char \*pathname, int oflag, …/\* mode_t mode \*/);
> - File/Path Name:
>> - PATH_MAX or NAME_MAX
>>