Looking ahead, fibres

Running thousands of scripts simultaneously on a grid requires some special programming. We can not just issue one thread per script and let it run. The resources required by each OS thread,both in terms of memory and thread switching is too high.

Instead we want to execute a few instructions of a script, then move to the next script. All status about execution location, memory, etc. must be kept within each script. So when the execution thread is moving between scripts it carries no payload from any of the scripts.

An important thing about computer technology is learning about the past. Because old technology is recycled all the time. In this case one could look at the “multitasking” done in Windows 3.11 to pick up a few ideas. Or Windows NT’s “fibre” support, a lightweight user space implementation of threads. And that is what it all boils down to, user space threading.

The clue here is to insert code into the script that will save it’s position, mark next spot with a “label” so it can jump to that position later, and exit execution. (details will follow once I get this far in the project)

There are two points where I can insert this data. Either during convert, or before load. Before load would be preferred as we then could load any .Net Assembly – great for future .Net scripting support. But the easiest way is during convert. And since this is Version 1 I will follow the easiest road.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Tedds blog

Subscribe now to keep reading and get access to the full archive.

Continue reading