Reputation: 369
I am new to assembly language. Whenever I initialize a memory segment for example: a code segment or a data segment, it is said that the OS allocates a portion of the memory for that. However, I am really confused by what my book means by "portion of memory". Is the code segment in the RAM to be specific?
Upvotes: 1
Views: 1370
Reputation: 8088
You've got a number of references in the comments, but I wanted to add that there are different states to consider in answering your core questions:
Upvotes: 2
Reputation: 92966
Yes! Typically, all segments are loaded into RAM. we distinguish various segments for efficiency and security reasons. For example, we distinguish text and data because text is executable but not writable whereas data is writable but not executable.
On embedded platforms, some sections might live in an EEPROM or flash ROM instead of RAM so they don't waste precious RAM. For the programmer, the only difference is that you can't write to such sections unless you do some special preparations.
Upvotes: 1