Reputation: 19452
In Linux when I call open() on a file, is the complete data loaded on the ram?
I am asking this because the file i need to open is a huge file(around 700MB). Such a large file, if it is getting loaded, it might create a problem for other applications and making the system slower.
If complete data is not loaded(because on demand paging or similar things), then what can we assume to be the initial size that is loaded?
Just if it matters, here are my file details.
File type : Binary
File Size : varies in between 700MB - 2GB
Upvotes: 1
Views: 606
Reputation: 310860
In Linux when I call open() on a file, is the complete data loaded on the ram?
No.
what can we assume to be the initial size that is loaded?
Zero.
Upvotes: 0
Reputation: 28087
No it doesn't. It just gives file a descriptor called file descriptor which then you can use to do read / write and some other operations. Think file descriptor as an abstraction or an handle over what lays on disk.
You should also read manual page for open. It states
The open() function shall establish the connection between a file and a file descriptor. It shall create an open file description that refers to a file and a file descriptor that refers to that open file description.
Upvotes: 1