Explain in detail the inter-connection between the terminal and read(), in cases of non-blocking reading of STDIN.
Bonus points for providing source code (showing where the terminal catches read(), or read() checks terminal attributes, or something about file flags, or something else)