What are the advantages of one vs the other?
Cheers!
Assuming you're using a traditional 8086 implementation with normal-sized
pointers, then having seperate stack and data segments means that you can't
address structures on the stack and structures on the heap using the same
kind of pointer; which rules out C as a programming language. However, your
application can now access 128kB of RAM.
The problem is that when the 8086 dereferences a pointer, it needs to be
told what segment the pointer is referring to, but the C compiler can't
know this. For example:
void doSomethingWithPointer(void* ptr);
{
char ThisIsOnTheStack[100];
char* ThisIsOnTheHeap = malloc(100);
doSomethingWithPointer(ThisIsOnTheStack);
doSomethingWithPointer(ThisIsOnTheHeap);
}
What form of instructions does the function use?
That said, this is an old and solved problem in the DOS world; it's usually
managed with compiler extensions that allow you to qualify pointers as
either only ever pointing at one particular segment, or else carry around
extra information to specify which segment they're pointing at ('far
pointers'). However, I don't think there are any Minix compilers that
support that.
--
+- David Given --McQ-+ "There is nothing in the world so dangerous ---
| d...@cowlark.com | and I mean *nothing* --- as a children's story that
| (d...@tao-group.com) | happens to be true." --- Master Li Kao, _The Bridge
+- www.cowlark.com --+ of Birds_
As far as I know Minix executable have and always had common data and
stack segment. What Minix has is separate/common text and data segments
and you can choose with -i (or -com/-sep) argument to cc.
As default separate text and data should be used. This format allows
text sharing among processes, i.e. if two processes run the same program
the text segment is loaded once in memory but each process will have its
own data/stack segment.
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>