Skip to main content
Login | Suomeksi | På svenska | In English

Browsing by Author "Mikkola, Risto"

Sort by: Order: Results:

  • Mikkola, Risto (2020)
    Programs today consist of several parts made in different languages. Different languages ​​are used because of the different benefits they offer. In the same program, languages ​​can be mixed by embedding an interpreter of a language into a program implemented in another language, so that the interpreter allows one language to run programs made in another. In order for the languages to work together, they ​​need to be built into an interface that allows them to communicate. Languages ​​are already different in their purpose, so various compatibility issues raise in the implementation of the interface between them. In addition, interpreters for multiple embeddable languages ​​are designed for single-threaded execution only, so using them in a multi-threaded program can compromise the efficiency or integrity of the program. In this work, we look for the problems of language interface and multi-threading in interpreter embedding and the solutions used for them with the help of the literature. As a practical work, we integrate a Lua interpreter into a multithreaded MMORPG server program programmed in C++. The use case of the embedded language sets practical limits on execution speed, so maintaining concurrency is paramount. In practical work, many isolated instances of the embedded language interpreter are created, which can be performed in parallel with different threads. Due to the use case, the instances have to share information with each other, which takes place through the serialization of the information. The applied part of the work and the solutions used in it are evaluated by simulating the structure and execution of the server program. We compare a single-threaded embedding of the interpreter to a parallel implementation and find that in the test situation we achieve the desired near-ideal execution speeds with the help of the parallel implementation. In addition to acceleration, we find that the increase in memory consumption is small relative to the benefits obtained.