To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 431
430  |  432
Subject: 
RE: RCX Programming Questions and Sensor Ideas
Newsgroups: 
lugnet.robotics
Date: 
Wed, 11 Nov 1998 00:30:12 GMT
Original-From: 
Eric Hodges <eric.hodges@platinumNOMORESPAM.com>
Viewed: 
2426 times
  
-----Original Message-----
From: Peter Hesketh [SMTP:pbh@phesk.demon.co.uk]
Sent: Tuesday, November 10, 1998 2:01 PM
To: lego-robotics@crynwr.com
Subject: Re: RCX Programming Questions and Sensor Ideas

In article <255199E650C3D11194BF00805FA785365101AB@cs03mail.BestBuy.com>
, Cwikla, Brian <Brian.Cwikla@BestBuy.com> writes
On page 4 of the Technical Reference in the Minstorms SDK there is a
reference to a semaphore mechanism.  It says:  It is possible to implement • a
semaphore mechanism (using one global variable and exploiting the
instruction set) to provide exclusive access to shared resources.  Could
someone explain this?  What it does, how to implement it and
advantages/disadvantages.(Especially helpful if from a VB position)  I've
only come across the following and don't understand it totally: A • semaphore
is a software mechanism that is used to control and coordinate multiple
program executions either on the same computer or on different computers • on
a network.

An example.  Say you want to prevent two tasks from fighting over motor
1.  Just insert an instruction in each task before operating the motor
to check that var 31 contains zero.  If it does, set var 31 to 1 and
control the motor, then set var 31 to 0 again.  If a task sees var 31 is
non-zero then you can program it to wait or abort as you wish.

--EBH But what if one task reads v31, then the context switches, then the
other tasks reads v31?  The first task would think it could lock the motor,
so it would.  Then the 2nd task would think it could lock the motor, and it
would.  Wouldn't it?  This isn't really semaphore support (which blocks
context switches between the get and set).



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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