Tuesday, May 08, 2018

[cbzfknaq] Coprocess idiom

Start a coprocess, and you are returned to a modified shell environment.  You can do all the things that you normally can in the shell environment, plus a few extra things enabled by the coprocess running in the background -- there are commands to interact with it.  The key idea is, you interact with the coprocess in an "open world", not a "walled garden".  When you are done, explicitly kill the coprocess, or exit the shell automatically killing it, freeing the memory and other resources that the coprocess was consuming.

Inspiration was loading a large database into memory, preprocessing it to allow for more rapid queries at the cost of greater memory, then running a bunch of queries against it, interspersed with processing the results of each query.

No comments :