sleyzerzon / soar

Automatically exported from code.google.com/p/soar
1 stars 0 forks source link

add RHS wait function #114

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
A common issue when running Soar agents is that they peg a processor core even 
when they aren't doing anything. When running on a machine with other software 
(e.g., other components that Soar is connected to), this can lead to bad 
performance of the overall system.

To work around this in jsoar projects, a pattern that we're using is to have a 
wait operator that calls jsoar's RHS wait function, like this:

sp "top-state*propose*wait
   (state <s> ^attribute state
              ^choices none
             -^operator.name wait)
-->
   (<s> ^operator <o> +)
   (<o> ^name wait)
   (wait 1) # since nothing to do, release the cpu for a moment
"

This basically causes the agent to sleep for 1 ms. This has no effect on the 
agent's performance when it is actively doing stuff, only when it is waiting 
(and it still gets a couple hundred dcs/sec while waiting this way). Our 
experience is that the cpu usage of the process drops to near 0 as a result.

It would be great if csoar could support this simple usage (jsoar's wait 
function actually has other more complex capabilities that we don't need). Of 
course, any csoar project could just implement this themselves, but the 
cross-platform issues are actually non-trivial, and csoar has already solved 
those internally, so it makes sense for csoar to natively provide this so 
people don't have to resolve those problems.

Original issue reported on code.google.com by bob.mari...@soartech.com on 2 Oct 2012 at 6:16