I will try to be very thorough in my response so please bare with me...
RAM stands for Random Access Memory and is more commonly referred to as just RAM or Memory.
Random Access Memory is volatile Memory. Meaning that once power is cut, whatever was being stored there is lost.
So, what is Random Access Memory and what is it used for?
Random Access Memory is the active work space the CPU has to perform the tasks it's been given.
A common analogy that is often given is.... RAM... it's like a desk your CPU sits at, to do the work it's been given.
Every task is a stack of paper work on the desk taking up space or in this case RAM.
The total amount of RAM you have installed, determines the size of this desk the CPU uses.
Each program you use on your computer, including the Operating System (OS){AKA Windows 10, Linux, Mac OSX, etc}, uses a certain amount of RAM to do what it must. This is why you aren't seeing the full 4 GB. It could also be you are using a 32 bit OS which limits the amount of RAM visible to the CPU to a little under 4 GB. You will always see less than what you install into your computer as the OS and other programs will use some RAM space for tasks they need to do or hardware will reserve a little for integrated video output or similar such things.
Now remember, you have a finite amount of space on your CPU's "desk". As more and more programs are opened and used, more desk space is used, or in this case, more RAM is used.
When you exceed the total RAM capacity your PC starts to use what is called virtual memory( AKA Page File or what is known in the Linux world as Swap Space ). To go with the previous analogy of the desk. When things don't fit on the desk, you have to file them away in a cabinet or put them in a stack someplace else in the room that isn't the desk you are working at. So when you need them again, it takes time to find them, and bring them back to the desk to work on them.
This is a file created on your hard drive that starts to act as extra RAM space. Programs you aren't using are then put into the Virtual Memory ( Page File ) on the hard drive and things you are actively using are then placed into RAM/Memory. What is in RAM can actively be worked on by the CPU. Whatever is not, well it needs to be swapped in to RAM before the CPU can work on it. To have the best experience possible on your PC you want to have a good amount of RAM installed so that the OS, programs you are using, and hardware devices can all satisfy their needs without requiring the use of virtual memory, which starts to slow the PC down considerably. Why do things slow down? Well the hard drive, even a Solid State Drive, are still much slower than your standard memory modules. So when you can, try to avoid using virtual memory to keep things snappy.
Hopefully this explanation has helped. Let me know if you have any questions