0

enter image description here

So here's the hierarchy, but I'm struggling with understanding why these two terms are called memory areas, and where they are located physically, and how they work in simple terms?

I'm also confused about stack as a data structure and a memory area... Please, anyone, help me clarify it in my head

trincot
  • 317,000
  • 35
  • 244
  • 286
Asol
  • 349
  • 3
  • 9
  • Bottom left, unless you are using your swap file or some of your data is cached, then it depends. There are lots of layers of caching. – Jodrell Aug 23 '22 at 14:48
  • So, If I understand correctly you have two questions : 1. Where are the stack and heap stored. 2. What is the difference between those and the data structure of the same name. Did I understand correctly ? – Irwene Aug 23 '22 at 14:48
  • This diagram is talking about the physical places that information can be stored. The stack and heap are virtual places that information is stored *per process*. Because of that, the bytes that make up a stack and heap for a given process can be in multiple physical locations, but are mostly going to be in RAM. – Welbog Aug 23 '22 at 14:49
  • 1
    @Jodrell They might go temporarily into the CPU cache though :D – Irwene Aug 23 '22 at 14:49
  • So, using images as the basis of questions is not really great, as it assumes people can see, leaving out the portion of the experts in the community who have visual impairments. – Heretic Monkey Aug 23 '22 at 14:50
  • @HereticMonkey or pernicious corporate policy blocking image providers or just a different screen resolution affecting the scale of a raster image. – Jodrell Aug 23 '22 at 14:52
  • I suppose you could be developing remotely over SSH or in https://dotnetfiddle.net/ then the Heap and Stack would be on some other machine with opaque implementation details. – Jodrell Aug 23 '22 at 14:55
  • 1
    @Jodrell My private fully conforming implementation of the CLI spec (ECMA-335) stores all objects on the moon, which is made of cheese. Meanwhile the logical execution stack with function parameters are written by hand on pizza boxes, which are stacked up in a counter in PizzaExpress. Or in other words, why would someone care where the data is stored? – Charlieface Aug 23 '22 at 19:11

0 Answers0