Richard Harter's World
Site map
August 2009
Mathcomp
San Language
email

July 25 2009: san_engine revisions

This is a summary of the changes to the san_engine code in the July 25 release. The code is not under revision control, but previous the previous release is archived at http://richardhartersworld.com/test/~cri_e/archives/sancode20090725/. However it is usable by the adventurous. Most of the changes were made to improve performance and to reduce memory footprint.

One change, technically cosmetic, was made to reflect a rethinking of how to use the package. The name of the engine's internal environment data structure was changed from 'crf' (common resource frame) to 'nest'. A nest is a collection of agents that share a common environment. The ultimate objective is to have many nests networked together. The idea of a common resource frame is valid but it should only contain information that is shared by all nests


  1. The strategy of using paired xpools (xpool_old, xpool_cur) has replaced. The code still uses xpools. However instead of switching pools in each scheduler cycle xpool's are freed when they go empty. A new one is created at the beginning of the scheduler unless the current one is empty. The overall strategy of putting all emissions into the the current xpool has been retained. The update_xpools and get_xpool_space functions have been deleted.

  2. A new function, clear_inport_queue, has been added. The queue must be cleared when an agent is deleted.

  3. A flag called notify_parent had been added to the calling sequence of delete_agent. When true, the agent is removed from the agent's children list. When false it is not. This is an optimization; the removal does not have to be done for the deletion of the chidren of an agent being deleted. San_delete_agent calls delete_agent with the flag set true; delete_agent calls itself with the flag set false.

  4. When an agent is created a pool is created for it. The agent's inports are taken from the pool. When an agent is deleted its pool is closed which automatically deletes the inports. There no longer is an inport free list.

  5. New structures called check_s and nestinfo_s were created. The third argument of the scheduler is a check_s struct. The fields are a flag called go_back, an optional callback function and test values for the epoch number and the user events number. The scheduler returns control to its caller at the end of a cycle if the go_back flag is set and either it hits the epoch number or the user event number. If the callback function is not null it is called with a nestinfo_s structure.

  6. Various constants were changed to reduce the memory footprint and enhance performance. In the Fibonacci tests memory usage was the single most important factor affecting performance. Execution times grew as phi**n until direct memory was exhausted.


This page was last updated July 25, 2009.

Richard Harter's World
Site map
August 2009
Mathcomp
San Language
email