In practice, this cannot be done because the OS will allocate a lot more memory overhead to track which descriptors are used by various processes. In the C code example, as shown below, I will demonstrate the simple structure of an OS process stored in a circular queue for an example ...
struct ProcessRecord {
int ProcessId;
CPURegs cpuRegs;
TaskPointer ** children;
int * baseMemAddress;
int sizeOfStack;
int sizeOfHeap;
int * baseHeapAddress;
int granularity;
int time;
enum State {Running, Runnable, Zombie ...};
/ * ... few more fields here ... * /
long * fileHandles;
long fileHandlesCount;
} proc;
Imagine that fileHandles is a pointer to an array of integers, each of which contains a location (possibly in encoded format) for shifting to the OS table where the files are stored on disk.
Now imagine how much memory that could eat and slow down the whole kernel can lead to instability, since the concept of "multitasking" the system will fall due to the need to track how many file descriptors are used and provide a mechanism for dynamically increasing / decreasing the pointer to integers that can cause the effect of pressing when the user program slows down, if the OS issues files for processing files on demand of the user program.
Hope this helps you understand why this is not implemented and practical.
Hope this makes sense, Best regards, Tom.
t0mm13b
source share