August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Project Task Page: Axon Quiescence Optimisation

Status: Completed
Current Developers: MH
Current "inflight" dev location: /branches/private_MH_axon_flowcontrolinversion
Start Date: May 2006
Expected End Date: n/a
End Date: May 2006
Date this page last updated: 22 February 2007
Estimated effort so far: 20 days



Description

Modifying axon so that components are not scheduled (ie. run) when they are paused. If all components are paused, then the whole Axon system sleeps until woken - it goes quiescent. As it stands, Axon does not do this - the scheduler keeps all microprocesses in a single list and polls all of them continually.

This is also an "inversion of flow control" - since it enables an Axon based system to become reactive to events, rather than polling.

Benefits:

Needed to make practical high data throughput Kamaelia systems, such as KamaeliaMacro.

Inputs

Task Sponsor: Michael (MS)

Task Owner: Michael, Matt (MH)

Developers: Matt (initial sketches and final code dev), Michael (final merge)

Users: Michael, Matt

Interested third parties: none

Requirements

Relevant Influencing factors:


Outputs

Expected

Actual

Code:

Experiments (in order):

CVS branch: private_MH_axon_flowcontrolinversion

Mainline code: /Code/Python/Axon/Axon/

Mainline code: /Code/Python/Axon/Axon/Tests

Bugfixes for components in mainline: (turned out several components did not use self.pause() properly)

Realistic possibilities arising as a result of activity on this task

Axon's support for the following was removed; and needed to be added back in again:

Task Log

Discussion

This work mainly centred on modifications to the scheduler - replacing its main loop with on that wouldn't iterate through inactive microprocesses, and providing a thread safe mechanism for submitting requests to it to activate, pause and unpause microprocesses.

Two variants were experimented on in /Sketches/MH/Inversion. cleverscheduling.py used queues for the pause/unpause/activate requests. aggregatedevents.py attempted to improve efficiency by building a table of changes, rather than simply queuing repeat requests. The former approach was adopted as it was slightly simpler to implement.

The following components notably underwent substantial overhauls to take advantage of the new quiescence capability, and in some cases, fixing buggy uses of self.pause():


-- Matt Hammond, 22 February 2007