To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.javaOpen lugnet.robotics.rcx.java in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / Java / 163
162  |  164
Subject: 
Re: LeJos threads / sleep() takes too long
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Wed, 6 Mar 2002 16:06:43 GMT
Viewed: 
3609 times
  
Hi Bart,

Bart Pattyn <rcx@ranavision.com> writes:

I have the impression my "try { sleep(nnn) }" takes
a somewhat arbitrary time. It's 'at least' nnn milisec,
but often much longer (particularly when sensorthread
has a lot of work, it seems).

if you mean LISTENER_THREAD then that sounds plausible.

Is this 'standard' Java behaviour?

Yes, LISTENER_THREAD has maximum priority, so it runs before
any threads of lower priority, even yield doesn't help.

It becomes very difficult to have a timed 'small
turn left' routine. Sometimes it turns a bit (as I want),
sometimes it makes a 180°. And no, I can't miss a rotation
sensor on this one (already 'overloading' sensors with light+touch etc)

Yes, I think we'll have to fix that somehow.

It seems a bit akward to go about and "implement" a
low-level sleep?! ( slicing sleep into 10ms and verify
system clock?)

That won't help you, if your thread doesn't run.

Is thread-priority the problem here? (not clear if
higest-priority threads really 'yields()')

I think the problem is that the sensor thread has maximum priority
and too much work to do, so it blocks other threads.

Any suggestions?

Play with Poll.setThrottle.

Have fun

Jürgen

--
Jürgen Stuber <stuber@loria.fr>
http://www.loria.fr/~stuber/



Message has 1 Reply:
  Re: LeJos threads / sleep() takes too long
 
The priority mechanism used in lejos is the same as that specified in the Real Time Specification for Java (RTSJ): Threads of a higher priority will absolutely block threads of a lower priority as long as they remain runnable. The sensor listener (...) (22 years ago, 1-Apr-02, to lugnet.robotics.rcx.java)

Message is in Reply To:
  LeJos threads / sleep() takes too long
 
Experimenting with Lejos, two 'major' problems: memory (cleaning up platform & lang: Math.class is huge!) and... threads. I have the impression my "try { sleep(nnn) }" takes a somewhat arbitrary time. It's 'at least' nnn milisec, but often much (...) (23 years ago, 6-Mar-02, to lugnet.robotics.rcx.java)

3 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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR