Information about Data Segment
A data segment is one of the sections of a program in an object file or in memory, which contains the global variables that are initialized by the programmer. It has a fixed size, since all of the data in this section is set by the programmer before the program is loaded. However, it is not read-only, since the values of the variables can be altered at runtime. This is in contrast to the Rodata (constant, read-only data) section, as well as the code segment (also known as text segment).
There are four basic memory regions in a program: Stack, Data, BSS, and Heap. Sometimes the data, BSS, and heap areas are collectively referred to as the "data segment".
There are four basic memory regions in a program: Stack, Data, BSS, and Heap. Sometimes the data, BSS, and heap areas are collectively referred to as the "data segment".
- The Data part contains constants used by the program that are not initialized to zero. For instance the string defined by
char s[] = "hello world";would exist in the data part. - The BSS segment starts at the end of the data segment and contains all global variables that are initialized to zero. For instance a variable declared
static int i;would be contained in the BSS segment. - The heap area begins at the end of the data segment and grows to larger addresses from there. The Heap area is managed by malloc, realloc, and free, which use the brk and sbrk system calls to adjust its size. The Heap area is shared by all shared libraries and dynamic load modules in a process.
See also
In computer science, object code, or an object file, is the representation of code that a compiler or assembler generates by processing a source code file. Object files contain compact code, often called "binaries".
..... Click the link for more information.
..... Click the link for more information.
In computer programming, a global variable is a variable that is accessible in every scope. Interaction mechanism with global variables are called global environment (see also global state) mechanisms.
..... Click the link for more information.
..... Click the link for more information.
programmer or software developer is someone who programs computers, that is, one who writes computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software.
..... Click the link for more information.
..... Click the link for more information.
Read-only generally refers to something that can be read, but not written to or modified.
In computing, read-only can mean:
..... Click the link for more information.
In computing, read-only can mean:
- Read-only memory (ROM), a type of storage media
- Read-only access to files or directories in file system permissions
..... Click the link for more information.
In computer science, runtime or run time describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time).
..... Click the link for more information.
..... Click the link for more information.
In computing, a code segment, also known as a text segment or simply as text, is a phrase used to refer to a portion of memory or of an object file that contains executable computer instructions. It has a fixed size and is usually read-only.
..... Click the link for more information.
..... Click the link for more information.
.bss or bss is used by many compilers and linkers as the name of the data segment containing static variables that are filled solely with zero-valued data initially (ie, when execution begins). It is often referred to as the "bss section" or "bss segment".
..... Click the link for more information.
..... Click the link for more information.
Segmentation is one of the most common ways to achieve memory protection; another common one is paging. Segmentation means that a part or parts of the memory will be sealed off from the currently running process, through the use of hardware registers.
..... Click the link for more information.
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus