The Linux kernel (= the main component of the Linux OS) keeps a list of all the files currently open by every running program. This list is called the file table, and its indexes are file descriptors (
fds), each uniquely representing a file.
fd as an argument (since they need to know which file(s) we want to change.)fds are non-negative integers (0, 1, 2, ..., n), so fd == -1 indicates an error. Each program has an upper limit of how many files can be opened at the same time (by default: n = 1000), but we can change this limit if wanted.fd == 0 represents standard input (= stdin = keyboard), fd == 1 is standard output (= stdout = display), and fd == 2 represents standard error output (= stderr = also printed to display). All 3 are open by default.fds can also represent special files (devices, disks, sockets, etc.) since Linux treats everything as a file.In the scope of our study of NASM coding, the only files that we will interact with are standard input (=
stdin = keyboard) and standard output (= stdout = screen), even though NASM has the tools for reading from and writing to other files (e.g., text files stored on the computer.)