image.png

user space - main and virtual adress space

"Virtual address space is the range of memory addresses given to a process by the operating system. These addresses are virtual, meaning they don't directly refer to physical RAM — they are managed by the system using actual RAM and sometimes disk (swap) in the background."



✅ Simplicity: Every program thinks it's the only one running and can use all memory from 0x00000000 to 0xFFFFFFFF.


image.png

  1. we open the file with permission and assign it return value to a file descriptor

image.png

  1. A file descriptor (FD) is a small integer (number) that a program uses to access a file or I/O resource like:each process gets it’s own filed descriptor table where the file they want to acess is given a number first 3 are reserved
  2. so basically whenever we open a file in a process in it procees unique file system we assign that file a number this number will be used bu=y other file operation fuctions to refer to this file
  3. and as it is process specific different processes can have overlapping file descriptors
  4. Example: If a process opens a file /home/user/data.txt, it might get file descriptor 3. The process uses 3 to read or write to that file.