Running instance of a program is called a PROCESS
If you have two terminal windows showing on your screen, then you are probably running the same terminal program
twice-you have two terminal processes.
Each terminal window is probably running a shell; each running shell is another process.
When you invoke a command from a shell, the corresponding program is executed in a new process
The shell process resumes when that process complete
A program is a passive entity, such as file containing a list of instructions stored on a disk
Process is a active entity, with a program counter specifying the next instruction to execute and a set of associated resources.
A program becomes a process when an executable file is loaded into main memory
A file descriptor table (FDT) is a data structure used by an operating system to keep track of open files and other resources, such as network sockets and pipes. It acts as an intermediary between processes and the actual files, providing a unique identifier (file descriptor) for each open resource. This allows processes to access and manage them efficiently without needing to know the underlying details of the files themselves.
Here's a breakdown of its key aspects:
What it is:
Maintains information about open files and resources: The FDT stores information about each open file or resource, including its location, access permissions, current file position, and other relevant details.
Provides unique identifiers: Each entry in the FDT is associated with a unique integer called a file descriptor (FD). This FD is used by the process to interact with the file or resource.
Facilitates efficient resource management: By using FDs, processes can easily switch between different files and resources without having to keep track of their individual details. This improves performance and simplifies programming.
The first three:
Standard input (stdin): Represented by FD 0, stdin typically refers to the keyboard from where the user enters input.
Standard output (stdout): Represented by FD 1, stdout is where the program's output is sent, usually displayed on the console or in a terminal window.
Standard error (stderr): Represented by FD 2, stderr is used for error messages and other non-standard output that should be distinguished from regular output.
These first three FDs are automatically opened for each process when it starts and are available for use without explicitly opening them.