The term “file” is heavily overloaded here. It might mean a file stored on an actual disk, but in this case it means anything accessed using the file API: open, read, write and close.
These four functions are a very generic API, and Unix always shoehorned various other things into this API. Character devices, block devices and named pipes are all accessed through the same four basic functions, but the thing being read and written is not file on a disk.
Traditionally the device files did have entries on the disk to keep the path lookup simple, but that would be inefficient for proc
as sys
filesystems, so they have custom lookup too and don't write anything to the disk at all. Nor does, for that matter, a tmp
filesystem, which simply keeps the data in the cache (and possibly swaps them out to the generic swap).
So when you are not accessing them, there is no overhead at all. When you do, all it takes is allocating the dentry, inode and file structures in kernel (to tie the file descriptor to) and formatting the information from the internal kernel structures. It is a bit slower than a dedicated API would be, but it avoids having to add more entry-points to the kernel and allows utilizing existing utilities for processing the information.