asyncframes - Parallel programming for software engineers¶
Version | asyncframes v1 | asyncframes v2 |
---|---|---|
Docs | ||
Download | ||
Source | ||
Status | ||
License |
asyncframes is a coroutine library for Python and a reference implementation of the Frame Hierarchy Programming Model (FHM). The goal of FHM is to help programmers design clean and scalable parallel programs. The main features of asyncframes are:
- Hierarchical code design
- Inherent and scalable parallelism
- Architecture independence
- Extensibility through frame classes (a class whose lifetime is bound to the execution of a frame)
Introduction¶
In the Frame Hierarchy Programming Model (FHM) a program is represented as a dynamic tree of frames. A frame is a suspendable function (a coroutine) with an object oriented context (the frame class) that only exists until the function returns. Frames can be used to represent both temporal processes (using the coroutine) and physical or conceptual objects (using the frame class).
Each FHM program has exactly one root frame. The root frame can recursively spawn child frames. Each child frame runs in parallel unless it’s awaiting another frame or an awaitable event. Frames of type Frame
run on a single thread. They use cooperative multitasking to simulate parallelism. Frames of type PFrame
run on any of the threads available in the event loop’s thread pool. Frame
and PFrame
are frame classes. They can be sub-classed to create specialized frame classes with encapsulated data.