Memory partition storage before and after program running

Before the program is run, it is the source code

  • After the program runs, an exe executable program is generated

It is divided into code area and global area
Code area:

  • Stores machine instructions executed by the CPU
  • The code area is shared. The purpose of sharing is that for frequently executed programs, only one copy of the code is needed in the memory.
  • The code area is read-only, and its read-only purpose is to prevent the program from accidentally modifying its instructions.
    Global area:
  • Global variables and static variables are stored here
  • The global area also includes the constant area, string constants and other constants are also stored here.
  • The data in this area is released by the operating system after the program execution is completed.

Insert image description here

Guess you like

Origin blog.csdn.net/qq_42817360/article/details/134388843