[comp.lang.c++] The Scheduler in the Task.h class consumes CPU when idle.

rmartin@worf.clear.com (Bob Martin) (11/07/90)

I have been experimenting with the "task.h" classes in the Sun
distribution of C++ 2.0.  I have been able to create tasks which
are happy to share the CPU as true coroutines.  I have also been
able to use the Interrupt class to catch timer signals in order to
implement timed delays for tasks.  However, when all tasks are 
blocked, waiting for an interrupt, the scheduler seems to hang
in an infinite loop consuming as much of the CPU as it can.  

Does anybody out there know how to fix this problem.  I would like
to use the task class, but cannot afford to have a process eat all
the available cpu.

							Thanks
										R. Martin

-- 
+-Robert C. Martin-----+---------------------------------------------+
| rmartin@clear.com    | My opinions are mine.  They aren't anybody  |
| uunet!clrcom!rmartin | elses.  And thats the way I want to keep it.|
+----------------------+---------------------------------------------+

steve@taumet.com (Stephen Clamage) (11/18/90)

rmartin@worf.clear.com (Bob Martin) writes:

|I have been experimenting with the "task.h" classes in the Sun
|distribution of C++ 2.0.  I have been able to create tasks which
|are happy to share the CPU as true coroutines.  I have also been
|able to use the Interrupt class to catch timer signals in order to
|implement timed delays for tasks.  However, when all tasks are 
|blocked, waiting for an interrupt, the scheduler seems to hang
|in an infinite loop consuming as much of the CPU as it can.  

|Does anybody out there know how to fix this problem.  I would like
|to use the task class, but cannot afford to have a process eat all
|the available cpu.

The implementation of the AT&T tasking library from Oregon Software sleeps
while waiting for interrupts, rather than busy-waiting.  You might want to
try it.  It does require the Oregon compiler, as it assumes Oregon-specific
code generation.  The tasking library is presently available for the Sun 3
series.

Disclaimer:  I wrote the implementation.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com