I'm reading an assembly book. The book explains that there are .text and .data section in a computer's memory. An example in the book also use the following source code.
[SECTION .data]
[SECTION .text]
since the above code snippet is written in assembly, I have a question.
Do .data and .text codes separated in physical memory (if so why? and does CPU care?) ? or is it just us (human) to separate them in the assembly language?
Text section of application is read-only while Data is not. Many OS load Text section into memory only once no matter how many times application was launched. This reduce memory usage and launch time and is safe because code doesn't change. Data section contains informations that could be changed during application execution and this section must be copied for every instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With