On some other architectures it grows the opposite direction. On the standard PC x86 architecture the stack grows toward address zero, meaning that more recent items, deeper in the call chain, are at numerically lower addresses and closer to the heap. With large address spaces and virtual memory techniques they tend to be placed more freely, but they still typically grow in a converging direction. The stack segment traditionally adjoined the heap segment and they grew towards each other when the stack pointer met the heap pointer, free memory was exhausted. Automatic variables are also allocated on the stack. A stack frame consists at minimum of a return address. The set of values pushed for one function call is termed a "stack frame". A "stack pointer" register tracks the top of the stack it is adjusted each time a value is "pushed" onto the stack. The stack segment contains the call stack, a LIFO structure, typically located in the higher parts of memory. rodata segments of the program, and the remainder which could be written to divided into a number of other segments for specific tasks. 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. This distinction grew from early systems holding their main program in read-only memory such as Mask ROM, EPROM, PROM or EEPROM. 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.Ī computer program memory can be largely categorized into two sections: read-only and read/write. This allowed a 16-bit address register, which would normally be able to access 64 KB of memory space, to access 1 MB of memory space. Each segment was placed at a specific location in memory by the software being executed and all instructions that operated on the data within those segments were performed relative to the start of that segment. The Intel 8086 family of CPUs provided four segments: the code segment, the data segment, the stack segment and the extra segment. Historically, to be able to support memory address spaces larger than the native size of the internal address register would allow, early CPUs implemented a system of segmentation whereby they would store a small set of indexes to use as offsets to certain areas. Uninitialized data, both variables and constants, is instead in the BSS segment. rodata), which contains static constants rather than variables it also contrasts to the code segment, also known as the text segment, which is read-only on many architectures. This is in contrast to the read-only data segment ( rodata segment or. The data segment is read/write, since the values of variables can be altered at run time. The size of this segment is determined by the size of the values in the program's source code, and does not change at run time. data) is a portion of an object file or the corresponding address space of a program that contains initialized static variables, that is, global variables and static local variables. In computing, a data segment (often denoted.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |