So what is RAM? It is short for Random Access Memory.
You can picture RAM as the link between your CPU and your storage (SSD, HDD, etc).
Anything the CPU needs is retrieved from storage, stored in RAM, and called upon by the CPU as required.
Very generally, the following are stored in RAM:
Otherwise know as code. This is the software you are running (e.g. MPD, Squeezelite, LMS). In Windows code is stored in a file and we refer to it as an exe (show for executable). This is the same in Linux, but we call them binaries. Libraries are code that can be reused by multiple applications. In general an application will require a multitude of these shared libraries to execute.
Software are not very useful running by itself.
Most software will load or generate data, manipulate it in some way to make themselves useful. For example, Microsoft Spreadsheet is the application, and the data is the contents in the spreadsheet. And if MPD is the application, the FLAC music files will be the data.
Data can be allocated in memory in one of two ways - heap or stack. And data can be categorised into many types (constants, buffers, variables etc). Explaining the technical differences of all this is beyond the scope of this blog. In the context of this article, it is sufficient to see them all as just data.
One of the roles of the Operating System is to divide all usable system RAM into individual units called ‘pages’. These pages are then assigned to each running process as needed.
Memory allocated to each process roughly looks like so:
The application (#1) is stored in the blue section, anything stored in this band can be executed by the CPU. Everything else is data.