| ??? 11/27/02 16:25 Read: times |
#33295 - RE: Simple 8052 O/S |
I'd say malloc and free are most applicable in data-intensive applications. Not really the stuff of embedded systems.
In case you are unsure of the data transfer rate through your embedded application, you could use linklists, but NOT using dynamically allocated blocks as Andy said. Dynamic allocation would be a headache in resource-constrained systems... just imagine the fragmentation caused (and the de-frag required) by freeing and allocing memory dynamically. You would need a whole bunch of data structures just to keep track of unallocated and allocated memory! Instead you'd allocate some number of structures at initialization in a well-defined area of RAM, and simply use or free them as required. However you will also need an array of strucures to maintain the index of blocks indicating which are used and unused... an unavoidable overhead. Speaking of overheads... Implementation-wise an (RT)OS is mostly a bunch of data structures to manage your resources. Now if managing your resources is a complex and dynamic enough task, thats when u use an RTOS. Personally I think an interrupt-driven polling loop/ finite state machine architecture (i.e. what people most often do.. execute tasks in a loop :)) ) is sufficient for 8052-level applications. kundi |



