To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 5430
5429  |  5431
Subject: 
Re: I need a little help with understanding processes
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Wed, 10 Feb 1999 02:50:18 GMT
Original-From: 
Max Davies <mdavies@cam.(AntiSpam)org>
Viewed: 
890 times
  
The most common problem many people have regarding processes is that they
incorrectly assume you should call start_process repeatedly in order to
keep a background process running.

This is completely wrong, and it will crash the system one way or another.

You should call start_process only once for any one background process that
you want to run.  When you start a subroutine with start_process, that
subroutine will start running completely independently of your main
program, or in other words, execution will continue immediately with
whatever follows your start_process call while the subroutine runs on its
own at the same time.  Typically a routine designed to be called by
start_process will contain an endless loop, which is just fine providing
that you only do a start_process on it only once.

If you call start_process for the same subroutine a second time before the
first subroutine ends you will end up having 2 copies of the same
subroutine running at the same time along with your main program.  If your
main program continues calling start_process repeatedly you will get
hundreds of copies of the subroutine running at the same time until
eventually (within a few seconds) the system will crash, normally with a
stack overflow error, although just about anything else could be possible
depending on the specifics of your program.



Message is in Reply To:
  I need a little help with understanding processes
 
Hi: I know the essential facts about IC's multitasking facilites and how to implement processes. But if you have too many processes is it normal for the board to reset? If so, how can it be prevented. Also how do I figure out for how many ticks to (...) (26 years ago, 9-Feb-99, to lugnet.robotics.handyboard)

2 Messages 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