Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/12/07 04:28
Modified:
  09/12/07 05:01

Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#144418 - It is the architecture
Responding to: ???'s previous message
Craig said:
It's not the 8051 architecture that dictates whether or not multitasking is reasonable, it's potentially the speed and/or the amount of memory available.

Well, sort of. Although a fast 8051 with lots of memory can certainly be made to support multitasking, whatever success that comes about will be in spite of the architecture and not because of it.

Here's why:

In most architectures, the stack pointer can be applied to a large address space. That means that some memory can be set aside for each task's stack, and that switching from one stack to another is as simple and quick as swapping a few registers and changing the stack pointer. In the 8051, however, the stack pointer only applies to the 128 or 256 bytes of internal data memory, and that's a problem. It means that a multitasking system must do one of two things:
  1. Guarantee that all the tasks' stacks can fit at the same time in the internal data memory, or
  2. At every task switch, copy the old task's stack to, then restore the new task's stack from external memory.
#1 is no good because any system complicated enough to need a multitasker in the first place is probably going to need more than the available stack space. And #2 is slow.

Now having said all that, I don't believe that you should reflexively dismiss the idea of multitasking on an 8051 in every situation. If you've got good reasons to use the 8051, and a real need for a multitasker, then multitasking is quite workable using the second technique mentioned above, especially on a fast derivative.

Some good news: There are some files here that show one way to do it. There is code for a simple, cooperative (i.e., not preemptive) multitasker and a small demo program that uses it.

Some bad news: While this code is pretty well commented, it's unsupported and there is no collateral documentation, so you will have to dig some in order to understand how it works. Also, it is both compiler- and platform-dependent, so the chances that you will be able to compile it and run it without modification are probably near zero.

-- Russ




List of 44 messages in thread
TopicAuthorDate
ABOUT THE REAL TIME OS            01/01/70 00:00      
   Do you really need it?            01/01/70 00:00      
      Seconds thoughts            01/01/70 00:00      
         but it's a 51 on steroids!... and some philosophy            01/01/70 00:00      
            Definitions            01/01/70 00:00      
               I use the p89c51rd2            01/01/70 00:00      
               It is the architecture            01/01/70 00:00      
                  Mutlitasking on the OS            01/01/70 00:00      
                     I think I said something similar...            01/01/70 00:00      
                     please tell which            01/01/70 00:00      
                        extended stack in SRAM            01/01/70 00:00      
                           Stack expanded to MOVX            01/01/70 00:00      
                  another architecture shortcoming            01/01/70 00:00      
                     Independent of multitasking?            01/01/70 00:00      
                        HUH??            01/01/70 00:00      
                           Clarification            01/01/70 00:00      
                              Identity crisis            01/01/70 00:00      
                                 Oops            01/01/70 00:00      
                                 No crisis here            01/01/70 00:00      
                           My question clarified            01/01/70 00:00      
                              "stack inefficiency"            01/01/70 00:00      
                                 Stack            01/01/70 00:00      
               I disagree somewhat            01/01/70 00:00      
                  Multitasking            01/01/70 00:00      
   I think I need it!            01/01/70 00:00      
      no, you do not            01/01/70 00:00      
         I have made a PLC complier for MCS-51 by VB.            01/01/70 00:00      
            Multi-use timers            01/01/70 00:00      
               Could you help me?            01/01/70 00:00      
                  No            01/01/70 00:00      
                  Software timers            01/01/70 00:00      
                     Linked Lists            01/01/70 00:00      
                     Linked Lists for Software Timers            01/01/70 00:00      
               I do not know how to do?            01/01/70 00:00      
                  Use software timers            01/01/70 00:00      
                     how to use it point to task.            01/01/70 00:00      
                        what is "a task" in your application?            01/01/70 00:00      
                        What task??            01/01/70 00:00      
                  stop running            01/01/70 00:00      
      Unlilely            01/01/70 00:00      
   DS89C450 can handle the RTOS?            01/01/70 00:00      
      PLCs            01/01/70 00:00      
         Russell got it            01/01/70 00:00      
         Thanks russell!            01/01/70 00:00      

Back to Subject List