??? 04/13/07 04:05 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#137104 - Not just embedded 'c' Responding to: ???'s previous message |
recursion and re-entrancy are concepts not only applicable to embedded 'c'.
As such recursion is different to re-entrant. Recursion is where a function calls itself. Re-entrant is where a function can be called whilst it is already executing. For a function to be re-entrant, it must create a copy of its variables each time it is called - opposed to this is a function that stores its variables in the same location every time. A recursive function must be re-entrant, otherwise not much useful work would be achieved. How does this apply to embedded systems? Many of the 8051 compilers do not generate re-entrant code. This is due to the limited memory space of these cpus. For a function's local variables, many compilers allocate fixed areas in memory and can overlay these areas in order to conserve memory space. On other cpus with more memory space, compilers usually will allocate local variable space on the stack, thus each call to the function will create fresh variables and thus re-entrant. In many cases, not having re-entrancy is not an issue, but you need to be aware of the implications and avoid the need for re-entrancy or work around the problem. This is all fundamental computer science stuff along with atomicity. If you remain blissfully unware of these, you will be bitten by them at some stage! |
Topic | Author | Date |
embedded c | 01/01/70 00:00 | |
Not just embedded 'c' | 01/01/70 00:00 | |
More precisely | 01/01/70 00:00 | |
thanks | 01/01/70 00:00 | |
of what?![]() | 01/01/70 00:00 | |
An example? | 01/01/70 00:00 |