How to create a data storage area?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
KieranFoot

How to create a data storage area?

Post 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. ???
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:How to create a data storage area?

Post by Pype.Clicker »

What exactly are you meaning with "data storage area"? a heap ?
KieranFoot

Re:How to create a data storage area?

Post by KieranFoot »

yeah thats the one???
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:How to create a data storage area?

Post 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.
Every good solution is obvious once you've found it.
KieranFoot

Re:How to create a data storage area?

Post by KieranFoot »

Thanx.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:How to create a data storage area?

Post 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...
Post Reply