Page 1 of 1

How to create a data storage area?

Posted: Fri Feb 27, 2004 7:51 am
by KieranFoot
Hi as you can see from my previous thread I'v restarted my OS project and I need a bit of help...

I want to know how you create a data storage area.
I'v seen a number of topics where people need to use data storage areas for things such as multitasking etc.

Say I wanted to use a stack for a data storage area.

If a program were to set a data storage pointer to the segment 6000 how would i go about pushing data into and poping data out of the stack. ???

Re:How to create a data storage area?

Posted: Fri Feb 27, 2004 8:04 am
by Pype.Clicker
What exactly are you meaning with "data storage area"? a heap ?

Re:How to create a data storage area?

Posted: Fri Feb 27, 2004 8:07 am
by KieranFoot
yeah thats the one???

Re:How to create a data storage area?

Posted: Fri Feb 27, 2004 8:13 am
by Solar
Now, either you have a heap (on which you allocate memory, like with malloc(), for random access), or you have a stack - on which you push / pop values.

Both have special CPU opcodes to support them. You'd best look up the relevant CPU manuals, since in both cases there's some background knowledge involved.

Re:How to create a data storage area?

Posted: Fri Feb 27, 2004 8:19 am
by KieranFoot
Thanx.

Re:How to create a data storage area?

Posted: Fri Feb 27, 2004 8:36 am
by Pype.Clicker
most of the cases, both heap and stacks are involved. The stack retains short-lived data (those you only access in a specific function like arguments or local variable) while the heap is intended to store longer-lived object which lifetime cannot be predicted at compile-time (like, for instance, a file descriptor)

It's usual to have references to heap-hosted object on the stack while having stack-hosted references in heap-hosted objects is usually a severe design flaw ...

The stack requires little management from the OS programmer (usually, the HLL takes care for it) while the HEAP is traditionnally to something be implemented...