Subject:
|
Re: multiplexor and legOS
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Tue, 5 Feb 2002 07:57:36 GMT
|
Viewed:
|
2439 times
|
| |
| |
On Mon, 4 Feb 2002, Robert Templeton wrote:
> delay() is just a not very well calibrated loop. msleep() uses delay if
> time and task management routines are not implemented anyway. Othewise it
> uses wait_event (and sys_time), which should be a good thing (?).
>
> Couldn't find any information about msleep() having a 20ms granularity. The
> standard firmware can do 10ms. Why should LegOS with assembler interface
> and compiled code be limited to 20ms?
Most people's legOS kernels will be compiled so msleep uses wait_event. I
haven't looked at the code, but my understanding of how wait_event works
is that whenever that thread becomes eligible to execute, your even
function is called. Depending on what it returns, your thread either
starts running, or goes back to sleep until it becomes eligible to run
again. The 20ms task switch time means that your event function could be
running only every 20ms (or more, if there are many other tasks running
and taking up CPU time). I suppose it could be less that 20ms under the
right conditions, but apparently that can't be relied on.
Here's a crazy idea. Have some kind of accurate_msleep which checks every
time the millisecond interrupt goes off, and switches to the thread in
question right away. Could this work as a solution for when accurate
timing is needed?
--
"From now on, we live in a world where man has walked on the moon.
And it's not a miracle, we just decided to go." -- Jim Lovell
Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>
|
|
Message has 1 Reply: | | Re: multiplexor and legOS
|
| (...) Actually, something like this has been documented and done by Pedersen, Christensen, Rasmussen ("Prioritized Interrupts in LegOS"). They actually document the problem of sensor misses related to task management, significantly reducing the (...) (23 years ago, 5-Feb-02, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: multiplexor and legOS
|
| (...) I don't know about this 20ms granularity and how delay() is going to be any better. Here's the code for each function: //! delay execution allowing other tasks to run. /*! \param msec sleep duration in milliseconds \return number of (...) (23 years ago, 4-Feb-02, to lugnet.robotics.rcx.legos)
|
19 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|