Implementing Emacs Threads

Two or three weeks ago in the comments to my post How Many Years Have You Been Using Emacs? I opined that the biggest thing missing from Emacs was a decent threading model. I also admitted that it was a very hard problem and one that I was glad I didn’t have to solve.

Dickmao is a braver soul and decided to try a proof of concept. After all, he said, how hard could it be? The problem with implementing threads in Emacs is that historically there was no lexical binding; all the non-local symbols were dynamically bound globals.

Dickmao’s idea was simple: give each thread its own obarray so that it would have its own copy of each symbol. It didn’t take any time at all for things to blow up. He immediately encountered a static buffer in the print routine. He played wack-a-mole for a while but there always seemed to be another problem.

He explains all this in his video. After you watch it, you will have a much better understanding of the problem with threads in Emacs. The video is only 4 minutes, 12 seconds so it should be easy to fit in.

This entry was posted in General and tagged . Bookmark the permalink.