Revolving around time travel and the world line theory (both equally hypothetical), there exists an anime by the name of Steins;Gate, one that I find to be quite intriguing - so much so that I decided to make a simple program reflecting one of its concepts!
I haven’t implemented what I initially thought of yet1, but I explained the base concepts of the anime in a GitHub repository for the ones who might be interested.
➤ Read an excerpt from my readme
As per the concepts established in the anime, time is comprised of infinite parallel lines called 'World Lines', which are mutable in nature. These lines can branch off (just like in Git/hierarchial stuff) at divergence points created by an event significant enough to create a separation. For instance, assume that a person died in the current timeline and in response to that you travel back in time to prevent his/her death. This action would create a divergence in the past from the time point of the person's death, resulting in two divergent world lines - one with the person's existence, and one without. The idea prevails for similar actions, wherein such changes induce the creation of multiple world lines.Note that such events that trigger the splitting of world lines can be of lesser magnitude in effect than the aforementioned case (based on the existence of a person, which is a strong example), such as simply from a point where someone didn't buy a winning-lottery ticket to one where he/she did. (which is the example used to illustrate the Butterfly effect)
Similar to the inclusion of divergence, there is this concept of convergence as well, which pertains to converging world lines. To elaborate on this, the term 'Attractor Field' needs to be known as a pre-requisite, so quoting from the fandom's wiki page: An Attractor Field is a cluster of world lines that lead to a single converging point. While each strand may be slightly different, they're ultimately part of the same great structure and yield the same end result.
The example used to convey this idea in the anime was the concept of a rope, held by its fibers. At a simple glance, a rope is unidirectional and comprised of interlocking threads, which can be thought of to represent the world lines. These threads although being twisted and different from each, altogether lock on to a converging point at the end of the rope, (plus move towards the same direction) which is the attractor field. Likewise, world lines are expected to have distinct individual changes, but for the ones in an attractor field, they all converge towards a specific event at a timestamp, something that will unequivocally occur.
This was an idea for a P4 (pointless personal pet project) that sparked off a few days ago after binge-watching the series, but I’m certainly glad to have decided to work on it, as I learned Golang and implemented some of its core features, apart from having fun (at least till S;G 0 kicked in) reviewing my favourite anime along the way.
Original Idea
Based on stochastic numbers produced via rng, goroutines are created, each of which represents a single thread-like instance of a world line. They are not inherently parallel or exhibit true parallelism like the theoretical world lines (or as per fiction-dictated rules), but they are processed with the number of cores available on the running machine. Based on different events that occur on each timeline, the program would organize and compute certain information, such as the existence of characters in a specific line.
This was the initial idea. The end result for the moment though, is a simple divergence calculator (as per the current status of my code on GitHub1) with a single goroutine, which is obviously, very impressive :)
That being said, one will still need to have Go set up in a multi-processor machine in order to run this simple program. (feel free to check my installations page for steps to install Golang on OS X, in case you haven’t installed it yet) The program won’t readily run inside the Go Playground since multiple cores aren’t available there (it is a single-processor virtual machine). And even if that were to be resolved at a future point, there are other drawbacks therein, such as the fact that it will give the same random numbers on every occasion, since time is fixed in Playground’s sandbox environment (with the seed being based on the current system time).
Parallelism
This construct is based on concurrently running goroutines but if one were to run each world line parallelly (as per the OG concept), then one option would to be lock goroutines to a particular CPU core.
Using a combination of functions runtime.LockOSThread to wire the goroutine to a thread and SchedSetaffinity with a zero process ID via the syscall
module to pin a specific thread to a logical CPU core, this can be achieved. But I didn’t see much point to dive into this level of complexity (plus make my ‘mini’-project more complex than it should necessarily be), so I’ve resorted to stick with the use of concurrently running goroutines, which practically behaves similar to parallel execution for such small programs. (and heck, even a single core is enough!)
KitKat
I’m currently engrossed in the process of preparing application material (plus giving the required tests) for my graduate application, so I’ll be taking a hiatus from writing blog posts until the work gets done, which is probably when ‘21 knocks at the door - so till then, Ciao!
Anirban | 10/15/2020 |