Merge branch 'master' of github.com:jeena/GGS-report
This commit is contained in:
commit
c36987a1e3
1 changed files with 38 additions and 45 deletions
83
report.lyx
83
report.lyx
|
@ -3523,7 +3523,7 @@ As mentioned earlier in the thesis, a prototype of the GGS has been developed
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
This chapter contains the realization of much of the principles and techniques
|
This chapter contains the realization of many of the principles and techniques
|
||||||
described in chapter
|
described in chapter
|
||||||
\begin_inset CommandInset ref
|
\begin_inset CommandInset ref
|
||||||
LatexCommand vref
|
LatexCommand vref
|
||||||
|
@ -3539,11 +3539,6 @@ reference "cha:Theory"
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Much of what is discussed in this chapter has been implemented in the GGS
|
Much of what is discussed in this chapter has been implemented in the GGS
|
||||||
prototype.
|
prototype.
|
||||||
Specific solutions such as
|
|
||||||
\emph on
|
|
||||||
supervisor structures
|
|
||||||
\emph default
|
|
||||||
and distribution of erlang nodes on physical nodes.
|
|
||||||
The different means of communications within the GGS and outside the GGS
|
The different means of communications within the GGS and outside the GGS
|
||||||
with third parties are also discussed here.
|
with third parties are also discussed here.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
@ -3578,11 +3573,11 @@ Light Weight Processes; LWP
|
||||||
\emph default
|
\emph default
|
||||||
much like the threads in an operating system.
|
much like the threads in an operating system.
|
||||||
There are however differences between operating system threads and the
|
There are however differences between operating system threads and the
|
||||||
LWPs of erlang.
|
LWPs in Erlang.
|
||||||
Threads in a Linux system, for example, are treated much like operating
|
Threads in a Linux system, for example, are treated much like operating
|
||||||
system processes in different systems.
|
system processes in different systems.
|
||||||
Due to the size of data structures related to each process, swapping one
|
Due to the size of the data structures related to each process swapping
|
||||||
process for another (known as
|
one process for another (known as
|
||||||
\emph on
|
\emph on
|
||||||
context switching
|
context switching
|
||||||
\emph default
|
\emph default
|
||||||
|
@ -3626,8 +3621,9 @@ textbf{Context switch}}{The act of switching from one context, commonly
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
The cost of swapping operating system processes becomes a problem when many
|
The cost of swapping operating system processes becomes a problem when many
|
||||||
processes are involved.
|
processes are involved.
|
||||||
If the GGS system had been developed using regular operating system processes,
|
If the GGS prototype had been developed using regular operating system
|
||||||
it would have had to be designed in a way to minimize the number of processes.
|
processes, it would have had to be designed in a way to minimize the number
|
||||||
|
of processes.
|
||||||
Using Erlang, which is capable of running very many processes, several
|
Using Erlang, which is capable of running very many processes, several
|
||||||
times more than an operating system, the relation between the real world
|
times more than an operating system, the relation between the real world
|
||||||
and the GGS (described in
|
and the GGS (described in
|
||||||
|
@ -3654,9 +3650,9 @@ In addition to creating (or
|
||||||
\emph on
|
\emph on
|
||||||
spawning
|
spawning
|
||||||
\emph default
|
\emph default
|
||||||
) processes specifically to handle new players connecting, the GGS has more
|
) processes specifically to handle new players connecting, the GGS has permanent
|
||||||
permanent processes running at all times.
|
processes running at all times.
|
||||||
The constantly running processes in the GGS system are called
|
The constantly running processes in the GGS prototype are called
|
||||||
\emph on
|
\emph on
|
||||||
modules
|
modules
|
||||||
\emph default
|
\emph default
|
||||||
|
@ -3758,7 +3754,7 @@ reference "fig:The-layout-of"
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
the entire GGS system is represented graphically.
|
the entire GGS system is represented graphically.
|
||||||
The circles marked with 'C' topmost in the picture represents game clients.
|
The circles marked with 'C' topmost in the picture represent game clients.
|
||||||
These circles represent processes running on gamers computers, and not
|
These circles represent processes running on gamers computers, and not
|
||||||
on the GGS machine.
|
on the GGS machine.
|
||||||
If a game of chess is to be played on the server, the clients on the machines
|
If a game of chess is to be played on the server, the clients on the machines
|
||||||
|
@ -3848,16 +3844,15 @@ In Erlang, everything is a process, and everything operates in its own memory
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Messages are sent between the processes in an asynchronous manner, and each
|
Messages are sent between the processes in an asynchronous manner, and each
|
||||||
process has a mailbox in which these messages can be retrieved.
|
process has a mailbox from which these messages can be retrieved.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Processes in Erlang are also called
|
Processes in Erlang are also called
|
||||||
\emph on
|
\emph on
|
||||||
Light Weight Processes.
|
Light Weight Processes
|
||||||
|
|
||||||
\emph default
|
\emph default
|
||||||
The Erlang processes are inexpensive to create.
|
because they are inexpensive to create.
|
||||||
Processes exist within an Erlang machine, or Erlang node.
|
Processes exist within an Erlang machine, or Erlang node.
|
||||||
The Erlang machine has its own scheduler and does not rely on the scheduler
|
The Erlang machine has its own scheduler and does not rely on the scheduler
|
||||||
of the operating system, this is a main reason of Erlang's capability of
|
of the operating system, this is a main reason of Erlang's capability of
|
||||||
|
@ -3872,7 +3867,7 @@ key "Armstrong03"
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
The strong isolation of Erlang processes make them ideal for multi-core
|
The strong isolation of Erlang processes makes them ideal for multi-core
|
||||||
and distributed systems.
|
and distributed systems.
|
||||||
Distribution of software is included as a fundamental part in the Erlang
|
Distribution of software is included as a fundamental part in the Erlang
|
||||||
language.
|
language.
|
||||||
|
@ -3884,12 +3879,12 @@ The strong isolation of Erlang processes make them ideal for multi-core
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
The distributed nature of Erlang is something the GGS can make use of, when
|
The distributed nature of Erlang is something the GGS can make use of when
|
||||||
scaling across several computers in order to achieve higher performance.
|
scaling across several computers in order to achieve higher performance.
|
||||||
The distribution is also important in creating redundancy.
|
The distribution is also important in creating redundancy.
|
||||||
The GGS prototype does not make use of the distributed nature of Erlang,
|
The GGS prototype does not make use of the distributed nature of Erlang,
|
||||||
however the GGS prototype is constructed in such a way that making use
|
however the GGS prototype is constructed in such a way that making use
|
||||||
of the distributed nature should now pose a big ptoblem.
|
of the distributed nature should not pose a big problem.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
@ -3956,7 +3951,7 @@ reference "sub:UUID"
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
and NIFs for interfacing with the virtual machines of games
|
and NIFs for interfacing with the GDL VMs
|
||||||
\begin_inset Foot
|
\begin_inset Foot
|
||||||
status collapsed
|
status collapsed
|
||||||
|
|
||||||
|
@ -4047,7 +4042,7 @@ The
|
||||||
\emph on
|
\emph on
|
||||||
gen_tcp
|
gen_tcp
|
||||||
\emph default
|
\emph default
|
||||||
behavior, which is used to work with TCP sockets for network communication.
|
behavior, which is used to interact with TCP sockets for network communication.
|
||||||
Using the gen_tcp behavior, network messages are converted to internal
|
Using the gen_tcp behavior, network messages are converted to internal
|
||||||
Erlang messages and passed to a protocol parser, where the messages are
|
Erlang messages and passed to a protocol parser, where the messages are
|
||||||
processed further.
|
processed further.
|
||||||
|
@ -4061,8 +4056,7 @@ gen_server
|
||||||
behavior, which is used when constructing OTP servers in Erlang.
|
behavior, which is used when constructing OTP servers in Erlang.
|
||||||
Using this behavior, a state can easily be kept in a server process, greatly
|
Using this behavior, a state can easily be kept in a server process, greatly
|
||||||
increasing the usefulness of the server process.
|
increasing the usefulness of the server process.
|
||||||
There are many gen_servers in the GGS, it is the most widely used behavior
|
This behaviour is the most widely used one in the GGS prototype.
|
||||||
in the project.
|
|
||||||
In addition to introducing a state to the server, the gen_server behavior
|
In addition to introducing a state to the server, the gen_server behavior
|
||||||
also imposes patterns for synchronous and asynchronous communication between
|
also imposes patterns for synchronous and asynchronous communication between
|
||||||
other gen_servers and other OTP behaviors.
|
other gen_servers and other OTP behaviors.
|
||||||
|
@ -4086,7 +4080,7 @@ In addition to supplying behaviors, the OTP also has a style for packaging
|
||||||
\emph on
|
\emph on
|
||||||
application
|
application
|
||||||
\emph default
|
\emph default
|
||||||
the GGS can be started in a way uniform to most erlang software, providing
|
the GGS can be started in a way uniform to most Erlang software, providing
|
||||||
familiarity for other Erlang users, and eases the incorporation of the
|
familiarity for other Erlang users, and eases the incorporation of the
|
||||||
GGS in other applications.
|
GGS in other applications.
|
||||||
\begin_inset ERT
|
\begin_inset ERT
|
||||||
|
@ -4297,7 +4291,7 @@ tt "Hello world"}
|
||||||
\series bold
|
\series bold
|
||||||
Records
|
Records
|
||||||
\series default
|
\series default
|
||||||
are erlang tuples coupled with a tag for each tuple element.
|
are Erlang tuples coupled with a tag for each tuple element.
|
||||||
This allows referring to elements by name instead of by position.
|
This allows referring to elements by name instead of by position.
|
||||||
An example of a record looks like this:
|
An example of a record looks like this:
|
||||||
\begin_inset ERT
|
\begin_inset ERT
|
||||||
|
@ -5809,7 +5803,7 @@ TODO: Go in to more detail about how the world, player and localstorage
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
My idea here is that we describe the erlang-js (which failed, but nontheless),
|
My idea here is that we describe the Erlang-js (which failed, but nontheless),
|
||||||
v8, UUID and other external communication.
|
v8, UUID and other external communication.
|
||||||
We shouldn't describe sockets here though..
|
We shouldn't describe sockets here though..
|
||||||
or..
|
or..
|
||||||
|
@ -6144,14 +6138,13 @@ Redundancy
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
The modules in the GGS are built to be capable of redundant operation.
|
The modules in the GGS are built to be capable of redundant operations.
|
||||||
By adding a backup process to sensitive processes, the state can be kept
|
By adding a backup process to sensitive processes, the state can be kept
|
||||||
in the event of a crash.
|
in the event of a crash.
|
||||||
The coordinator of the GGS prototype has this backup feature built in.
|
The coordinator of the GGS prototype has this backup feature built in.
|
||||||
The coordinator passes state along to the backup process which keeps the
|
The coordinator passes state along to the backup process which keeps the
|
||||||
data safe.
|
data safe.
|
||||||
In the event of a crash, the coordinator recovers the state from the backup
|
If a crash occurs, the coordinator recovers the state from the backup process.
|
||||||
process.
|
|
||||||
Figure
|
Figure
|
||||||
\begin_inset CommandInset ref
|
\begin_inset CommandInset ref
|
||||||
LatexCommand ref
|
LatexCommand ref
|
||||||
|
@ -6268,11 +6261,11 @@ Testing
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
In order to make sure the GGS prototype adheres to the specification set,
|
To make sure the GGS prototype adheres to the specification set, two different
|
||||||
two different approaches to software testing are used.
|
approaches to software testing are used.
|
||||||
For simpler testing the GGS prototype uses unit tests.
|
For simpler testing the GGS prototype uses unit tests.
|
||||||
Modules are tested on a high level, making sure each function in the module
|
Modules are tested on a high level, making sure each function in the module
|
||||||
tested functions according to specification.
|
tested functions has been tested according to specification.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
@ -6299,14 +6292,14 @@ Unit testing
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Unit testing is a way to check if the functionality adheres to the specification
|
Unit testing is a way to check if the functionality adheres to the specification
|
||||||
of the system by manually creating test cases for sections of code.
|
of the system by manually creating test cases for sections of code.
|
||||||
In most cases whole functions.
|
Usually whole functions.
|
||||||
Unit testing is good, not only for revealing software bugs, but also to
|
Unit testing is good, not only for revealing software bugs, but also to
|
||||||
state that a feature is working according to the specification.
|
state that a feature is working according to the specification.
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Unit testing is a useful way to create regression tests.
|
Unit testing is an useful way to create regression tests.
|
||||||
Regression tests are used to make sure changes made to the GGS do not introduce
|
Regression tests are used to make sure changes made to the GGS do not introduce
|
||||||
new bugs or break the specification.
|
new bugs or break the specification.
|
||||||
The regression tests are optimally run very often, such as after each change
|
The regression tests are optimally run very often, such as after each change
|
||||||
|
@ -6316,7 +6309,7 @@ Unit testing is a useful way to create regression tests.
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Erlang provides a module for unit testing called eunit.
|
Erlang provides a module for unit testing called eunit.
|
||||||
Eunit, being a part of OTP, is rich in functionality and well documented,
|
Eunit, being a part of OTP, is rich in functionality and well documented,
|
||||||
it doesn't however allow any means of testing asynchronous behaviours as
|
it does not however allow any means of testing asynchronous behaviors as
|
||||||
opposed to other means of software testing.
|
opposed to other means of software testing.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
|
@ -6327,8 +6320,8 @@ Automated test case generation
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
The problem of writing software tests manually is that it takes a lot of
|
The problem of writing software tests manually is that it takes a lot of
|
||||||
time.
|
time.
|
||||||
There exists other ways to test software that address this problem by generatin
|
There exists other ways to test software that addresses this problem by
|
||||||
g test cases with certain properties.
|
generating test cases with certain properties.
|
||||||
This allows for testing functions with a lot of different input parameters
|
This allows for testing functions with a lot of different input parameters
|
||||||
without having to implement each specific test itself.
|
without having to implement each specific test itself.
|
||||||
|
|
||||||
|
@ -6341,8 +6334,8 @@ By having each test automatically generated, each test can be very complex
|
||||||
By using QuickCheck the GGS can be tested with input which would be extremely
|
By using QuickCheck the GGS can be tested with input which would be extremely
|
||||||
difficult to construct using manual testing methods.
|
difficult to construct using manual testing methods.
|
||||||
Regression tests, such as the unit tests used by the GGS are more useful
|
Regression tests, such as the unit tests used by the GGS are more useful
|
||||||
for ensuring the system does not diverge from a working scenario than for
|
for ensuring that the system does not diverge from a working scenario than
|
||||||
finding new cases where the specification does not hold
|
for finding new cases where the specification does not hold
|
||||||
\begin_inset CommandInset citation
|
\begin_inset CommandInset citation
|
||||||
LatexCommand citet
|
LatexCommand citet
|
||||||
key "Arts:2006:TTS:1159789.1159792"
|
key "Arts:2006:TTS:1159789.1159792"
|
||||||
|
@ -6366,7 +6359,7 @@ QuickCheck has features to generate very large and complex tests, the results
|
||||||
\emph on
|
\emph on
|
||||||
minimal failing test case
|
minimal failing test case
|
||||||
\emph default
|
\emph default
|
||||||
which contains the smalles failing test sequence.
|
which contains the smallest failing test sequence.
|
||||||
By applying a very large test and gradually simplifying the test to find
|
By applying a very large test and gradually simplifying the test to find
|
||||||
the smallest failing sequence, many bugs which would other wise have been
|
the smallest failing sequence, many bugs which would other wise have been
|
||||||
hard to catch can be caught
|
hard to catch can be caught
|
||||||
|
@ -6381,7 +6374,7 @@ key "Arts:2006:TTS:1159789.1159792"
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
QuickCheck was originally made for the programming language Haskell.
|
QuickCheck was originally made for the programming language Haskell.
|
||||||
There are a lot of reimplementations of QuickCheck in various programming
|
There is a lot of reimplementations of QuickCheck in various programming
|
||||||
languages.
|
languages.
|
||||||
Erlang QuickCheck (EQC) and Triq are two variants of QuickCheck for Erlang.
|
Erlang QuickCheck (EQC) and Triq are two variants of QuickCheck for Erlang.
|
||||||
EQC was chosen for testing the GGS.
|
EQC was chosen for testing the GGS.
|
||||||
|
@ -7355,7 +7348,7 @@ There are two JavaScript virtual machines, or
|
||||||
\emph on
|
\emph on
|
||||||
engines,
|
engines,
|
||||||
\emph default
|
\emph default
|
||||||
with suitable bindings to erlang available at the time of the writing of
|
with suitable bindings to Erlang available at the time of the writing of
|
||||||
this thesis.
|
this thesis.
|
||||||
There is a group of machines developed by Mozilla called
|
There is a group of machines developed by Mozilla called
|
||||||
\emph on
|
\emph on
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue