TransWikia.com

How does computer memory store the file name?

Computer Science Asked by Shane Studio on October 21, 2021

I have this doubt for long time. When i save a notepad file, it takes the memory for the information in the file. let’s say, I type ‘ABC’ in notepad and saved the filename as stack, it shows that the memory consumed 3 bytes for the file but what about the file name " stack" ? Where does it store that particular information in our memory?

One Answer

You are right, the computer saves the file name somewhere. But not, it isn't kept in a "stack" or in "memory", files are kept on external memory (disk, flashdrive, perhaps even somewhere else "on the cloud"). This memory in turn is organized to give an efficient map from file names (stored in filesystem proper data structures) to file contents (arranged so it is e.g. possible to extend the file, erase it's contents and reclaim the space, ...). When you ask your operating system for the file size, it answers with the user-visible space (as that is what you presumably are interested in). The space used up in management of the above (file name, references to the pieces used by this file, map of free space on the device, directory structure for managing names, ...) is usually not your concern. You can ask for it if you look at "how full is the device", just that the space used for management usually can't really be associated with a particular file, it is used by many files together.

Get some book on operating systems, and look up "file systems". Or check simple examples like the (MS-DOS) FAT filesystem or the Unix file system design (just concentrate on the Version 7 one, with it's simple layout). File systems in current use are very complex beasts, trying to squeeze out performance of humongous, glacially slow, rotating disks or levelling wear on fast SSDs.

Answered by vonbrand on October 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP