To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 825
824  |  826
Subject: 
RE: stop task
Newsgroups: 
lugnet.robotics.nxt
Date: 
Wed, 25 Jul 2007 01:13:39 GMT
Viewed: 
21822 times
  
Everyone,

Being fair in the judgement in using a global watchdog flag to terminate a
task.   Honestly, when I have a multi-threaded process, I have always used a
watchdog type of flag, mutex, semaphore, etc. to signal a thread to
terminate. I hardly abruptly terminate a thread so that a thread can perform
graceful exit.  Having said that, the function for abrupt termination "is
handy", but "not highly recommended".   In other words, being able to "stop"
a task anytime is "handy", but "not a good practice".

Lugnet has been a great playground for our technical people to have
technical fun... stimulating ideas and all.  I enjoyed it immensely.
Therefore, I hope my question does not start anything unpleasant.

--E


-----Original Message-----
From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com] On Behalf Of
Brian Davis
Sent: Tuesday, July 24, 2007 1:47 PM
To: lugnet.robotics.nxt@lugnet.com
Subject: Re: stop task

In lugnet.robotics.nxt, John Hansen wrote:

It is not a rather awkward option, imho.  That's like saying
breaking out of an infinite loop using a flag is awkward and
that it would be better to have some form of stop loop keyword
that you could use from outside the loop instead.

Well, you may not consider that awkward, but having been able to use the
"stop"
& "start" task commands in NQC, I do actually consider it very awkward. For
instance, if I want to immediately stop some task under the "stock" FW...
well,
I can't. I can have that task check a flag every so often, but if I actually
want it to stop right *now*, there's no good way to implement that. It means
if
I want a complex sequence to be very responsive to outside events of some
type,
i need to have it spend a lot of code (and execution time) on checking flags
repeatedly, often... when under the previous stock 2.0 FW for the RCX, this
could be handled behind the scenes and at a much faster rate within the FW.

Likewise the lack of a true "Wait" style command, that can pause a task
without
consuming bytecode execution time, is a real issue, or the ability to
interrupt
tasks using something like "acquire" or "monitor". All these are shortcuts,
true... but if I'm using an interpreted bytecode language (slow), it would
be
very nice, in fact almost critical for some things, that I can use built-in
(i.e., fast!) FW functions for these sorts of controls.

Is it ideal to have to set a flag?  No.  But it is extremely
easy to implement and it works very well.

Again, that is an opinion we don't share I fear. I'm trying to get a mobile
platform to handle a real environment, where it could be picked up, or
flipped
over, by actions outside its own (as well as its own actions). I can easily
see
how to implement responses with things like start/stop and monitor/acquire,
but
with me having to do all the coding to manully check a series of state
variables, and having to do it slowly because it's all at the bytecode
level,
well... I can think of better ways.

There is, by the way, no such thing as the NXT-G FW (firmware).
It is the standard NXT firmware not the NXT-G firmware.  Please
try to not muddy the waters in this regard.  NXT-G is the name
of a programming language that targets the standard NXT firmware
but it is not the name of the firmware.

Fair enough. Everyone who was confused by my choice of phrasing, please
raise
your hand... to all of you, sorry 'bout that, I'll try to use the glossary
in
the future :-). Generally, I just try to use words that communicate ideas...
and
I assumed that by saying "NXT-G firmware", folks could interpret that
correctly
as "the firmware on the NXT that runs the bytecode program generated by the
upper level language NXT-G" (since the first is significantly shorter than
the
second).

I'm sure you did not call it the LASM firmware or the
MindScript firmware or the RIS or ROBOLAB firmware (or
not even the NQC firmware).

Actually, that's a very good point. I think I usually just called it the
"standard firmware" or "LEGOs firmware". The problem is there are now
several of
these, at least three for the RCX and several for the NXT. So saying "the
standard firmware" is somewhat ambiguous now as well.

--
Brian Davis



Message has 1 Reply:
  Re: stop task
 
(...) It hasn't, Elizabeth - I'm not upset at John, and he knows *far* more about programming than I do. I just wanted to point out that there are process where abruptly "killing" a thread was one of the best solutions I ever found, due to the speed (...) (17 years ago, 25-Jul-07, to lugnet.robotics.nxt)

Message is in Reply To:
  Re: stop task
 
(...) Well, you may not consider that awkward, but having been able to use the "stop" & "start" task commands in NQC, I do actually consider it very awkward. For instance, if I want to immediately stop some task under the "stock" FW... well, I (...) (17 years ago, 24-Jul-07, to lugnet.robotics.nxt)

6 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