Registers, discussed later, are used to store and keep track of the
current segments a process maintains. Offset registers are used to keep track of where in
the segment the critical pieces of data are kept.
Programs in Memory
When processes are loaded into memory, they are basically broken into many small sections.
There are six main sections that we are concerned with, and we??™ll discuss them in
the following sections.
.text Section
The .text section basically corresponds to the .text portion of the binary executable file. It
contains the machine instructions to get the task done. This section is marked as readonly
and will cause a segmentation fault if written to. The size is fixed at runtime when
the process is first loaded.
.data Section
The .data section is used to store global initialized variables such as:
int a = 0;
The size of this section is fixed at runtime.
.bss Section
The below stack section (.bss) is used to store global noninitialized variables such as:
int a;
The size of this section is fixed at runtime.
Heap Section
The heap section is used to store dynamically allocated variables and grows from the
lower-addressed memory to the higher-addressed memory. The allocation of memory is
controlled through the malloc() and free() functions.
Pages:
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287