!-- Using MathJax, with the delimiters $ -->
Date lör 24 september 2016

My next task for guile-log is to make paralell engines store and restorable. This does not work before. In order to see how one can solve this with the already implemented framework, lets first recap paralell engines.

By issuing paralell engines e1,...en we device a scheme where we manually control how to backtrack into these engines and by doing so we simply keep the other engines fixed. Now they maight share state and this will be adressed later, but for now assumed that this is solved. Now when we backtrack into one engine we woule like to do that with the tools we already have, e.g. call a fail thunk, that can be stored from one of the engines and pushed forward. This means that the compared with swi engines, this construct is more open and depednent of the environment. If we have a gigantic datastructure inputted to the engine for example, that datastructure can be shared and hence the overall algorithm performs well.

So what do we need to do when we store the state. We need to store all dependent engines. So when we dive down in each branch we store cons all branches onto a stack and when we then store the state we examing this stack and construct a corresponding stack of storage tags, each tag relating to the same engine. At restorage we need to do the reverse. We also store the current path of active engines e.g. engine a in engine b in engine c etc.

At restorage we first look at the different engine paths e.g.

Restore = [a,...,c,...]
Current = [b,...,c,...]

So what we need to do is to basically first unwind [b,...] and then build up [a,...,c,...] by first install the last c engine, then restore that, then continue so all the way back to the front, when we do this we look at the stored branch data as well and make sure to restore all neighbouring data structures.

That's it.

So this is not super difficult, the ideom is not secure though. Redo safe variables will not behave is a such variable is modified in multiple paralell engines.


Comments

comments powered by Disqus

~ Follow me ~