Quantcast
Channel: What are file descriptors, explained in simple terms? - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by Sidney for What are file descriptors, explained in simple terms?

$
0
0

I'm don't know the kernel code, but I'll add my two cents here since I've been thinking about this for some time, and I think it'll be useful.

When you open a file, the kernel returns a file descriptor to interact with that file.

A file descriptor is an implementation of an API for the file you're opening. The kernel creates this file descriptor, stores it in an array, and gives it to you.

This API requires an implementation that allows you to read and write to the file, for example.

Now, think about what I said again, remembering that everything is a file — printers, monitors, HTTP connections etc.

That's my summary after reading https://www.bottomupcs.com/file_descriptors.xhtml.


Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>