Distributed execution of program

Is it possible to run a program on the MaidSafe network so that it could run anywhere on the network, or could spawn threads that run on different servers? If so, how do you handle running the program on computers with different architectures?

Yes this already is possible (outside of MaidSafe) and there are many different flavours of “distributed applications”. At present there are many examples from traditional client-server systems to certain agent based systems and the likes of SETI@home.

What I think you are asking though is; “Can I take an application that I currently run in isolation on my computer and run this over a distributed public network”. The answer to this yes however it’s probably not very practical or safe.

If your programs threads share any data then this data is going to have to be available to every node which is running a thread. If a node updates some shared data then all other threads (on different nodes) have to know about this change and you’ve also got to have safety mechanisms so that threads can lock access to critical regions. If your threads don’t share any data then you can easily acheive this just by having completely seperate processes running on distinct nodes.

If you want to get lower than this and actually have a single thread executing across multiple nodes then you need to be able to communicate CPU state in addition to the memory.

Depending on what you’re trying to acheive you could well find that the time required for each node to communicate would dwarf useful CPU time and you’d be much better off executing the software on a single machine.

So, yes all these things are possible however it’s not suitable for every type of application. The higher the degree of isolation a peice of code can execute in the more suitable/practical it is for distributed execution.

The cross architecture problem has already been solved by use of emulators, interpreters, JIT compilers, etc.

I won’t carry on much longer but there would obviously be massive security issues if the SAFE Network allowed nodes to execute arbitrary code on any node. There’d need to be a way to guarantee that one of your threads couldn’t cause my node harm. Even if your code entered an infinite loop I would class it as harming my node.