To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 172
171  |  173
Subject: 
Re: NQC 2.0 and some math questions
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 1 Oct 1999 06:05:14 GMT
Viewed: 
2447 times
  
On semaphores...

There was a lot of discussion a long time ago on whether NQC should use
semaphores to protect temp variables between tasks.

There isn't an atomic test-and-set bytecode, so the only way I know of
implementing sempaphore would be to use bitflags and assign one bit per
task.

In the end, I decided that semaphore implementation was just too slow and
cumbersome on the RCX, and probably unwarranted most of the time during
expression evaluation.  My solution was to just duck the problem entirely
and make sure that temp variables are never shared between tasks.  This
has the odd consequence that if a subroutine (not a function) is called
from two different tasks, it cannot allocate local variables or temp
variables.

Dave

In article <37F3DC70.58E60D04@get2net.dk>, Jacob Schultz
<dungeonmaster@get2net.dk> wrote:

Dave Baum wrote:
My personal feeling on this, however, is that if you're running around
changing y amd z in one task while calculating with them in another,
you're just asking for trouble.
I think that if you do something like this you should use a semaphore
to secure no tasks access y and z simultanously. But that wastes another
variable storing the sema.

--
reply to: dbaum at enteract dot com



Message has 1 Reply:
  Re: NQC 2.0 and some math questions
 
(...) There is a way to do it even if you have no test and set, though I can't remember it off the top of my head, and it is slow. Don't see how using bitflags helps? Cheers, Ben. -- (URL) grandfather once told me that there are two kinds of people: (...) (25 years ago, 1-Oct-99, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Re: NQC 2.0 and some math questions
 
(...) I think that if you do something like this you should use a semaphore to secure no tasks access y and z simultanously. But that wastes another variable storing the sema. (25 years ago, 30-Sep-99, to lugnet.robotics.rcx.nqc)

16 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