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 / 7783
Subject: 
Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Fri, 29 Oct 1999 00:46:23 GMT
Original-From: 
Brian Connors <connorbd@yahoo.AVOIDSPAMcom>
Viewed: 
584 times
  
As some of you may know, about three weeks ago I
released a package called NQCIPC that provides a basic
API for semaphores and intertask messaging on NQC.
Originally written for NQC 1.x, it's been updated for
2.x and I'd be interested in seeing what all of you
think of it. I'd especially be interested in feature
suggestions (if practical); I'd also like a better
name than NQCIPC if someone has an idea (anyone like
Spectre (by analogy with spirit.ocx)?).

The home page is

http://www.geocities.com/ResearchTriangle/Station/2266/nqcipc/nqcipcdoc.html

and it contains everything relevant to the package.
Check it out and let me know what y'all think.

Brian Connors


=====
--


Subject: 
Re: Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Fri, 29 Oct 1999 16:04:27 GMT
Reply-To: 
TKING@saynotospamTOGETHER.NET
Viewed: 
586 times
  
Brian, this looks very useful; I'll try it out soon!

NQCIPC made perfect sense to me, but I have had my
Nerd Merit Badge for a long time.

People who have never done anything with multitasking
before will not recognize other related words
like Semaphore, Blocking, Deadlock, Pipe etc, anyway.

My older Grandchildren easily included Rcx and RcxCode
in their vocabulary, and then NQC and RcxCC.  The
alliteration in NQC-IPC makes it roll off the tongue
and easy to remember.  My vote: Go with it.

Thanks for your work!

--
Regards,
Terry King   ...In The Woods In Vermont


Subject: 
bug in semaphore code (was Re: Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Fri, 29 Oct 1999 23:49:53 GMT
Viewed: 
1260 times
  
Your semaphore acquire algorithm isn't too good. Here is your code:

#define sem_acquire(s)  until (s == 0); s = 1;

If two tasks are waiting for the semaphore at the same time, it is quite likely
that both will get it:

  // (s is currently nonzero)
  task 1: until (s == 0);
  task 2: until (s == 0);
  task 3: s = 0;
  task 1: until (s == 0);
  task 2: until (s == 0);
  task 3: // whatever
  task 1: s = 1;
  task 2: s = 1;
  // at this point, task 1 and task 2 both think they have the semaphore

Dave Baum and I and a few others talked about this issue 4 weeks ago in this
thread:

http://www.lugnet.com/robotics/rcx/nqc/?n=172

The result was code that properly handles the lockstep starvation problem as
well as making sure that only one task uses the semaphore at any given time.
The solution requires the tasks to have task ID numbers.

I will repeat the proper code here:

    int lock; // the semaphore
    #define TASK_BIT(task_num)  (1 << task_num)

    // this is written as if subroutines were legal in NQC, actually
    // you would implement it as an inline function or a macro
    void acquire_lock(int task_num)
    {
      while(true)
      {
        // wait for lock to be clear
        while(lock);

        // try to own it
        lock |= TASK_BIT(task_num);

        // see if we own it
        if (lock == TASK_BIT(task_num)) {
          return;
        } else {
          lock &= ~TASK_BIT(task_num);
          Sleep(task_num);
        }
      }
    }

- Robert Munafo

In lugnet.robotics, Brian Connors writes:
As some of you may know, about three weeks ago I
released a package called NQCIPC that provides a basic
API for semaphores and intertask messaging on NQC.
Originally written for NQC 1.x, it's been updated for
2.x and I'd be interested in seeing what all of you
think of it. I'd especially be interested in feature
suggestions (if practical); I'd also like a better
name than NQCIPC if someone has an idea (anyone like
Spectre (by analogy with spirit.ocx)?).

The home page is

http://www.geocities.com/ResearchTriangle/Station/2266/nqcipc/nqcipcdoc.html

and it contains everything relevant to the package.
Check it out and let me know what y'all think.

Brian Connors


Subject: 
Re: bug in semaphore code (was Re: Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Sat, 30 Oct 1999 00:17:42 GMT
Viewed: 
929 times
  
In lugnet.robotics, Robert Munafo writes:
[...]
Dave Baum and I and a few others talked about this issue 4 weeks ago in this
thread:

http://www.lugnet.com/robotics/rcx/nqc/?n=172

The result was code that properly handles the lockstep starvation problem as
well as making sure that only one task uses the semaphore at any given time.
The solution requires the tasks to have task ID numbers.

I will repeat the proper code here:
[...]

Robert,
Cool stuff.  I just added it here:

   http://www.lugnet.com/robotics/rcx/nqc/?p=code

--Todd


Subject: 
Re: bug in semaphore code (was Re: Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Mon, 1 Nov 1999 00:52:12 GMT
Reply-To: 
tking@together.^nomorespam^net
Viewed: 
928 times
  
Todd, this is CoolBut:  It does not appear to appear
from NNTP. Is it your intention to have, um..
lugnet.robotics.rcx.nqc.code  ??

I like the idea a lot of having a code repository...

--
Regards,
Terry King   ...In The Woods In Vermont


Subject: 
strange sample code area in LUGNET (was Re: bug in semaphore code (was Re: Announce: NQCIPC update
Newsgroups: 
lugnet.robotics
Date: 
Mon, 1 Nov 1999 22:45:08 GMT
Viewed: 
1035 times
  
What is

http://www.lugnet.com/robotics/rcx/nqc/?p=code

and why are there no links connecting the rest of
http://www.lugnet.com/robotics/rcx/nqc/ to it?

In lugnet.robotics, Todd Lehman writes:
Robert,
Cool stuff.  I just added it here:
  http://www.lugnet.com/robotics/rcx/nqc/?p=code
--Todd


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