Memory mannagment

Derek Ragona derek at computinginnovations.com
Thu Jun 14 17:12:38 UTC 2007


At 01:15 AM 6/14/2007, cadastrosonline cadastrosonline wrote:
>First of all,
>
>
>
>"Each process has its own private address space. The address space is 
>initially divided
>into three logical segments: text,
>data, and stack. "

You would be wise to read up on Processors and assembly language 
programming.  The concept of segments is part of assembly language 
programming and often is built into CPU's.  In the case of the intel 80x86 
line this is very true.

To answer the questions:

text is usually program code, and should not be modifiable
stack is temporary storage of program values and variables
data is data for the program, this defines variable used in a program




>But if the address is just something like 343556 then how does it
>really work? The memory is divided into segments is that what it means?

Segments are kept separated by the CPU, and some treatment of segments can 
be enforced with some CPU's.  Text being non-modifiable is possible using 
some CPU's.  Some data segments can be read only as well.

To address memory locations vary by CPU and even by the mode the CPU is 
running in.  Some are linear address, but not necessarily.




>"The data segment contains the initialized and uninitialized data portions 
>of a program"

In the case of a modifiable data segment, it will contain initialized data, 
and non initialized data.
initialized data looks like:
int i=5;

versus uninitalized data:
int j;




>Is it talking about multithreading? I COULDNT FIND anything talking
>about how freebsd deals with multithreading, just found out it does it
>by man pthread.

Threading is a separate topic.  Segments and how they work predates 
multi-threading.



>Tell me anything else interesting to know about memory mannagment, does
>it use any algorithm to substitute a page when out of pages in memory?
>such as "second chance" "fifo" "lru" (last recently used) "nfu" (not
>frequently used) and so on? I am studying freebsd but sometimes I am
>out of ways to find out, yes I am reading the handbook about memory
>mannagment as you can see my quotes but sometimes I don't understand.

Memory management varies by CPU and operating system.  You would need to 
research each implementation to understand how it is handled in each 
case.  Memory management should be transparent to application programers, 
and usually is only required for those programing device drivers and other 
hardware level devices.

         -Derek

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



More information about the freebsd-questions mailing list