Content deleted Content added
m WP:CHECKWIKI error fix. Broken bracket. Do general fixes if a problem exists. - using AWB (11756) |
Reverted to revision 692966490 by Hatchet1337 (talk): Revert to pre-vandalism version. using TW |
||
Line 8:
This segmenting of the memory space into discrete blocks with specific tasks carried over into the programming languages of the day and the concept is still widely in use within modern programming languages.
==Program memory==
A computer program memory can be largely categorized into two sections: read-only and read-write. This distinction grew from early systems holding their main program in [[read-only memory]] such as [[Mask ROM]], [[Programmable read-only memory|PROM]] or [[EEPROM]]. As systems became more complex and programs were loaded from other media into RAM instead of executing from ROM the idea that some portions of the program's memory should not be modified was retained. These became the ''.text'' and ''.rodata'' segments of the program, and the remainder which could be written to divided into a number of other segments for specific tasks.
Line 14 ⟶ 13:
===Data===
[[File:Typical computer data memory arrangement.png|150px|thumb|This shows the typical layout of a simple computer's program memory with the text, various data, and stack and heap sections.]]
[[File:The .data segment contains any global or static variables which have a pre-defined value and can be modified. That is any variables that are not defined within a function (and thus can be accessed from anywhere) or are defined in a function but are defined as static so they retain their value across subsequent calls. Examples, in C, include:▼
▲
int val = 3;
char string[] = "Hello World";
The values for these variables are initially stored within the read-only memory (typically within ''.text'') and are copied into the ''.data'' segment during the start-up routine of the program.
===BSS===
|