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. ???
How to create a data storage area?
- Pype.Clicker
- 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?
What exactly are you meaning with "data storage area"? a heap ?
Re:How to create a data storage area?
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.
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.
- Pype.Clicker
- 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?
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...
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...