Subject:
|
BrickOS Multithreading
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sat, 4 Jan 2003 15:46:21 GMT
|
Viewed:
|
844 times
|
| |
| |
Hi,
I did some research in my free time at the public holidays :-).
So the questions do we really need a real multithreading???
In my constructions I never used threads with the same priority, because it
doesent make sense to turn on a motor and 20 ms later turn off from an other
thread.
My suggestion is to replace the "real" multitasking with a simplified one.
Here is my idea:
- only tasks with different priority exists
- all additional task have a "wakeup function" with a short duration
- the 1 ms timer interrupt will call all "wakeup functions" to check, if a
task must be activated
- if the timer interrupt dedects that a other tread must be activated, he
simply changes the return address of the interrupt routine with the address
of the task function.
- if the task function exits the saved original return address is used
Therefore we get a dynamic function call system. The advantages are:
- less memory consumption (no need for a stack for every thread)
- fast response times (wakeup functions are checked every millisecond)
Suggestions or hints are really welcome.
Best regards
Bert Weber
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|