Why do computers need RAM memory? And why some programs require lots of it while others require less?

245 views

Just curious about it, but can’t understand why is it like that.

In: 7

15 Answers

Anonymous 0 Comments

CPUs will perform a certain sequence of calculations every clock cycle. We ideally want memory fast enough such that the CPU can retrieve the data from it within a clock cycle.

However, due to material, space and power constraints, we can’t solely use the super fast memory (the super fast memory typically being L1 cache, which can be accessed within 1-2 clock cycles).

Therefore we established a hierarchical memory structure:

1) L1 cache (few hundred kilobytes, fastest)

2) L2/L3 cache (tens of megabytes, extremely fast)

3) RAM (gigabytes, fast)

4) storage drive (terabytes, slow)

As to what the RAM is used for, it’s whatever data the application you have opened need to store, for a web browser it would be webpages (HTML, Javascript, media content), the sandbox environment the webpages run in and user interface icons.

A game would need to store object data, the game’s code, sounds and textures not currently in VRAM but might need to be used soon.

There are algorithms such as First In First Out that determines what data should go where, since we want the frequently used data inside the L1 cache and the less frequently used data inside the RAM.

In large datacenters such as Facebook or Google, they also develop caching algorithms to allocate data between fast SSDs and slower HDDs for the sake of faster transfer to the client. The goal is to predict what data might be needed soon/more frequently and move them to the SSD.

You are viewing 1 out of 15 answers, click here to view all answers.