VPython Multithreading
Claimed by Philip Bale
Here we discuss multithreading as it relates to advanced VPython physics computations
Overview
Multithreading is the ability to execute multiple processes (or threads) concurrently. Instead of a single execution flow, multiple program paths may be followed at once. With multithreading, programs may no longer be executed strictly in a linear manner. The notion of multithreaded parallelism in computing is similar to multitasking in real life--the idea is to get more done at once.
Multithreading is very important to VPython. Imagine a Solar System model. Though it would be possible to model and update the entire system in a linear fashion, when it comes to movement and animation, the computation can get incredibly intense. Since your computer shares it's process cycles with various other programs, you may notice significant lag while trying to achieve your task. Multithreading, however, would allow you to model and update each Planet (or even subsystems of a planet, etc.) concurrently. For a system of thousands of relevant objects, the speed improvement could be many orders of magnitude with multithreading.
As an analogy, think of multithreading as a single employee vs. an assembly line. A car could simply be worked on by a singular person. It may also, however, be worked on by multiple people performing their own tasks at the same time. The idea of multiple tasks being executed at the same time is the essence of multithreading.
Advantages
Multithreading allows advanced and complex computations to be performed more efficiently due to concurrency. The asynchronous potential of multithreaded programs supports smoother graphical renderings and more accurate user input as well. While one thread is performing mathematical computations, another could be rendering models on screen, while another is taking user input. The modularity of threading allows users to break down processes as they see fit. Furthermore, various threads may share global objects. This allows for mutual cooperation and sharing when necessary.
Disadvantages
Insert text here
A Mathematical Model
What are the mathematical equations that allow us to model this topic. For example [math]\displaystyle{ {\frac{d\vec{p}}{dt}}_{system} = \vec{F}_{net} }[/math] where p is the momentum of the system and F is the net force from the surroundings.
A Computational Model
How do we visualize or predict using this topic. Consider embedding some vpython code here Teach hands-on with GlowScript
Examples
Be sure to show all steps in your solution and include diagrams whenever possible
Simple
Middling
Difficult
Connectedness
- How is this topic connected to something that you are interested in?
- How is it connected to your major?
- Is there an interesting industrial application?
History
Put this idea in historical context. Give the reader the Who, What, When, Where, and Why.
See also
Are there related topics or categories in this wiki resource for the curious reader to explore? How does this topic fit into that context?
Further reading
Books, Articles or other print media on this topic
External links
References
This section contains the the references you used while writing this page