2

As much I know about a memory and storing data there would always be a managing type feature in every memory which manages all the data and its location. So, what is the file system of a RAM. I also like to know the format or type (mp3, pdf, png, txt, jpg or binary) of data stored in.

Vivek Ji
  • 131
  • 6

2 Answers2

3

Think of the file system and its files as a big cabinet with lots of physical folders in an office of bureaucrats. The sheets in the folders are arranged in fixed ways such that every bureaucrat knows exactly where to expect which information before taking the folder out of the cabinet.

Not let us assume that a bureaucrat (a program) performs a certain operation on a folder/file. It will take the folder to the desk, spread the sheets on the desk, cut certain things out, glue them together, paint marking son certain sheets, translates the text of a sheet to a new one, discards sheets entirely, add sheets, and do all kinds of crazy stuff on the data on the desk in the way that the bureaucrat wants it to do. After all that, the bureaucrat puts the relevant sheets nicely back into the folder such that everything is orderly, puts the folder back into the cabinet and then throw everything that is left on the desk back into the trash bin.

Note that the bureaucrat's desk is the RAM in this analogy. Now how are things stored on the desk? Well, that depends on what precise step the bureaucrat performs at a time instant. Even more, different bureaucrats doing essentially the same task may do things in a different order. So we can't really say anything about the organization of a bureaucrat's/program's desk/RAM other than whatever is put back into the cabinet/file system is put there orderly. In between, it is up to the bureaucrat how things are stored and in which encoding.

For most data in the RAM, the question how it is encoded does however make sense. However, this encoding can change frequently. For example, when a web browser receives text from a server, it may change the encoding multiple times before the data is actually displayed.


I hope that this analogy helps clearing things up. It has its limits, though, as in a computer, folders are not taken out of the cabinet, but they are rather copied and later overwritten, as this is cheaper in a computer than it is in real life. Also, because the memory sizes of the processes in a computer are not fixed, there is memory management going on, and one can say something about where memory allocation information is stored and how that information is encoded.

DCTLib
  • 2,817
  • 17
  • 13
1

The equivalent to a file system for RAM would be the MMU (memory management unit)

Back in the day many systems didn't have one and poorly written programs would crash each other or the OS by violating each others address space. As technology progressed some processors offered additional MMU chips and eventually they were integrated into the processors that we have today. The MMU with the OS work to give programs an address block to load and run in. They keep track of the address blocks programs use via paging tables. They also handle fragmentation of memory blocks that have been freed.

As for how data is handled inside a programs memory space, that is left up to the programmer, though high level languages have developed best practices on how to handle memory.

innerspace
  • 11
  • 1