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 / 7339
7338  |  7340
Subject: 
Re: multitasking
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Sat, 22 Jan 2000 23:40:25 GMT
Viewed: 
858 times
  
In my reading of it, it will just chew the cycles. Here is the routine
msleep(), used to implement sleep. See how it just does a busy wait? I wrote
a version (now gone into data heaven when my drive crashed) that would check
the time, and then give up its time slice using the function that does that
(not handy at the moment). This approach gave up accuracy, but at least gave
up the time for other processes.

void msleep(long msec)
{
    long end_time= mseconds() + msec;

    while (1) {
/* if the following test doesn't execute at least once a second,
    msleep may not halt */
long done= mseconds()-end_time;
if (done >= 0L && done <= 1000L) break;
    }
}

--chris prosser


----- Original Message -----
From: "Scott harris" <scottrharris@earthlink.net>
To: <lugnet.robotics.handyboard@lugnet.com>
Sent: Saturday, January 22, 2000 1:10 PM
Subject: multitasking


How clever is the multitasking in IC?  If I have a task that I only want • to run
ever 10 seconds, can I just put a sleep statement at the top of the • routine?
Will the sleep statement chew up processor cycles, or will IC realize that • it
should defer to the next task until the sleep time is over?

-Scott Harris




Message is in Reply To:
  multitasking
 
How clever is the multitasking in IC? If I have a task that I only want to run ever 10 seconds, can I just put a sleep statement at the top of the routine? Will the sleep statement chew up processor cycles, or will IC realize that it should defer to (...) (24 years ago, 22-Jan-00, 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