7. Mobile Multi-Agent Systems for the Internet-of-Things and Clouds using the JavaScript Agent Machine Platform and Machine Learning as a Service
7. Mobile Multi-Agent Systems for the Internet-of-Things and Clouds using the JavaScript Agent Machine Platform and Machine Learning as a Service
Mobile Multi-Agent Systems for the Internet-of-Things and Clouds using the
JavaScript Agent Machine Platform and Machine Learning as a Service
Stefan Bosse
University of Bremen, Department of Mathematics & Computer Science, Bremen, Germany
Abstract—The Internet-of-Things (IoT) gets real and is self-organizing MAS. Cloud-based computing with MAS,
becoming part of pervasive and ubiquitous computing networks e.g., as a base for cloud-based design and manufactur-
offering distributed and transparent services. A unified and
common data processing and communication methodology ing, means the virtualization of resources, i.e., storage,
is shown to merge the IoT, sensor networks, and Cloud- processing platforms, sensing data or generic information
based environments seamless, which is fulfilled by the mobile [5]. Mobile Agents reflect a mobile service architecture.
agent-based computing paradigm. Currently, portability, re-
source constraints, security, and scalability of Agent Processing Commonly, distributed perceptive systems are composed of
Platforms (APP) are essential issues for the deployment of sensing, aggregation, and application layers, shown in Fig. 1.
Multi-agent Systems (MAS) in strong heterogeneous networks But IoT and Cloud environments differ significantly in terms
including the Internet, addressed in this work. Agents are
directly implemented in JavaScript, which is a well known and of resources: The IoT consists of a large number of low-
public widespread used programming language, and JS VMs resource devices interacting with the real world and having
are available on all host platforms including WEB browsers. strictly limited storage capacities and computing power, and
The novel proposed JS Agent Machine (JAM) is capable
to execute AgentJS agents in a sandbox environment with the Cloud consists of large-scale computers with arbitrary
full run-time protection and Machine learning as a service. and extensible computing power and storage capacities in
Agents can migrate between different JAM nodes seamless a basically virtual world. A unified and common data
preserving their data and control state by using a on-the-fly
code-to-text transformation in an extended JSON+ format. A processing and communication methodology is required to
Distributed Organization System (DOS) layer provides JAM merge the IoT with Cloud environments seamless, fulfilled
node connectivity and security in the Internet, completed by by the mobile agent-based computing paradigm, discussed in
a Directory-Name Service offering an organizational graph
structure. Agent authorization and platform security is ensured this work. The scalability of complex industrial applications
with capability-based access and different agent privilege levels. using such large-scale cloud-based and wide area distributed
networks deals with systems deploying thousands up to mil-
Keywords-Agents, IoT, Cloud Computing, Agent Platforms lion agents. But the majority of current laboratory prototypes
of MAS deal with less than 1000 agents [2]. Currently, many
I. I NTRODUCTION traditional processing platforms cannot yet handle a big
The Internet-of-Things gets more and more real in to- number of agents with the robustness and efficiency required
day’s life and is becoming part of pervasive and ubiquitous by the industry [2] and Cloud applications. In the past decade
computing networks offering distributed and transparent the capabilities and the scalability of agent-based systems
services. Agents are already deployed successfully in pro- have increased substantially, especially addressing efficient
duction and manufacturing processes [1], and newer trends processing of mobile agents. The integration of perceptive
poses the suitability of distributed agent-based systems for and mobile devices in the Internet raises communication and
the control of manufacturing processes [2], facing manu- operational barriers, which must be overcome by a unified
facturing, maintenance, evolvable assembly systems, quality agent processing architecture and framework, discussed in
control, and energy management aspects, finally introducing this work.
the paradigm of industrial agents meeting the requirements In this work the behaviour of mobile agents are mod-
of modern industrial applications by integrating sensor net- eled with dynamic Activity-Transition Graphs (ATG), which
works. Multi-agent systems can be already successfully are directly implemented in JavaScript (JS) program code
deployed in sensing applications, e.g., structural monitoring holding the entire control and data state of an agent.
[3]. The agent model bases on the mobile processes model
In [4] the agent-based architecture considers sensors as introduced by Milner [6] several decades ago. The code
devices used by an upper layer of controller agents. Agents can be modified by the agent itself using code morphing
are organized according to roles related to the different techniques (directly supported by JavaScript Just-in-time
aspects to integrate, mainly sensor management, commu- Compiler VM platforms), and that is capable to migrate in
nication and data processing. This organization isolates the network between nodes. This approach requires only a
largely and decouples the data management from changing minimal Agent Processing Platform Service (APPS) and a
networks, while encouraging reuse of solutions. Distributed RPC-based Distributed Organization System (DOS) layer for
data mining and Map-Reduce algorithms are well suited for the deployment in the Internet domain, entirely implemented
245
Figure 1: Unified Distributed Perception and Information Processing with mobile agents and a JavaScript (JS) Agent Machine Platform (JAM) and
Programming model AgentJS. An optional Distributed Organization System (DOS) layer [7] adds connectivity and security to JAM in the Internet domain.
complex design challenge. High-level agent programming simplifies the programmatically implementation.
and behaviour modelling languages can aid to solve this An activity is activated by a transition depending on the
design issue. Reactive activity-based agent models can aid evaluation of (private) agent data (conditional transition)
to carry out multi-agent systems on low-resource platforms. related to a part of the agents belief in terms of BDI ar-
In this work, agents are modelled with a reactive be- chitectures, or using unconditional transitions (providing se-
haviour model. The behaviour of a reactive activity-based quential composition), shown in Fig. 2. Each agent belongs
agent is characterized by an agent state, which is changed to a specific parameterizable agent class AC, specifying local
by activities. Activities perform perception, plan actions, agent data (only visible for the agent itself), types, signals,
and execute actions modifying the control and data state activities, signal handlers, and transitions.
of the agent. Activities and transitions between activities are AAPL Agent Classes, Reconfiguration, and Instantiation.
represented by an activity-transition graph (ATG). The ATG- The AAPL programming model(detailed description in [7])
based agent-orientated programming language AAPL [7] was relies on the ATG behaviour model by means of an agent
designed to offer the modelling of the agent behaviour on class template containing activity and transition sections,
an easy-to-understand programming level, defining activities shown in. Fig. 2. APPL offers statements for parameterized
with procedural statements and transitions between activities agent instantiation, like the creation of new agents and the
with conditional expressions (predicates), which is suitable forking of child agents inheriting the parent state, using the
for beginners and non-experts. Though the imperative pro- new(args) and fork(args) statements, respectively.
gramming model is quite simple and closer to a traditional There are statements for ATG transformations and com-
PL it can be used as a common source and intermediate position. Agents can modify their behaviour at run-time
representation for different agent processing platform im- by reconfigure the ATG using transitionX(ai , aj ,
plementations (hardware, software, WEB, simulation). cond?) and activityX(a1 , a2 , ..) statements with
The agent behaviour and the action on the environment is X=+(add), -(remove), *(update), respectively.
encapsulated in agent classes, with activities representing the AAPL Agent Interaction. Furthermore, unified agent inter-
control state of the agent reasoning engine, and conditional action is provided by using synchronized Linda-like tuple
transitions connecting and enabling activities. Activities pro- database space access and signal propagation (messages
vide a procedural agent processing by a sequential execution carrying simple data delivered to asynchronous executed
of imperative data processing and control statements. Agents signal handlers).
can be instantiated from a specific class at run-time. A multi- Access of the tuple space is granted by using in(TP),
agent system composed of different agent classes enables the rd(TP), rm(TP), exist?(TP), and out(T) primitives
factorization of an overall global task in sub-tasks, with the (T: n-dimensional value tuple,TP: n-dimensional tuple with
objective of decomposing the resolution of a large problem value patterns), reading, removing, testing, or generating tu-
into agents in that they communicate and cooperate with ples, respectively. Reading bases on template pattern match-
each other. ing and can block agent execution if there is actually no
The activity-graph based agent model is attractive due match. Tuple-space communication is generative, i.e., a tuple
to the proximity to the finite-state machine model, which is independent of the generating process after generation,
246
: Cond
Figure 2: Agent behaviour programming level with activities and transitions (AAPL, middle); agent class model and activity-transition graphs (left); agent
instantiation, processing, and agent interaction on the network node level (right) [12].
and can have a lifetime beyond the generating process. vironments, including single microchip implementations.
For some situations, tuple can remain in the tuple space One major feature of AAPL agents is the capability of
never consumed. To avoid a flooding of tuple spaces with reconfiguration and agent behaviour (re)composition at run-
”orphan” tuples, the mark(tmo, T) operation can be used time. The code-based agent platforms therefore support this
to store tuples with a limited lifetime tmo, which are de- by enabling and using code-morphing.
stroyed by the TS manager automatically. These marking are To simplify the development and deployment of multi-
extensively used in divide-and.-conquer systems discussed agent systems it would be desirable to implement AAPL
in the following sections. A signal SIG can be sent to an agents directly in JavaScript(JS), which is a well known and
agent specified by its ID identifier using the send(ID, public widespread used programming language. JS execution
SIG, ARG) statement. A signal can be send to a group platforms are available for a very broad range of devices
of agents of a specified agent class AC and within a given and operating systems, e.g., Intel x86/x64, Arm32, Linux,
local range Δ by using the broadcast(AC, Δ, SIG, Windows, Solaris, MacOS, FreeBSD, Android, IOS, and
ARG) statement. many more. Furthermore, the implementations of mobile
AAPL Agent Mobility. Agent mobility (migration) is pro- agents directly in JS would benefit from actually existing
vided by the moveto(DIR) statement. The destination can high-performance JS VMs, e.g., Googles Chrome V8 or
be a geometric direction (e.g., NORTH), a delta-distance Mozillas Spidermonkey engines with Just-in-Time native
vector, a host port, or an URL/IP address. code compilation (JIT). JS is a very simple but highly
AAPL Machine Learning. Learning agents can access dynamic language covering procedural, object-orientated,
basic machine learning operations provided by the platform and functional concepts. Even if a JIT-based VM is used,
as a service, using model= learn(datasets, classes, fea- full code-to-text and text-to-code transformation is preserved
tures, alg?) and classify(model, dataset) primitives. at any execution time, including functions and data. This
The agent stores only the learned model, and do not carry enables the capability of code morphing at run-time, a
any learning algorithms or previous training sets. prerequisite for AAPL-based agents, used to store the current
state of an agent process (e.g., prior to migration) and to
III. JAM: AGENT P ROCESSING M ACHINE P LATFORM modify the behaviour of an agent by applying a recomposi-
Commonly, agents are implemented with some high-level tion to the ATG by the agent itself. In contrast to JAVA and
modelling and programming language having a specific, common JAVA-based agent frameworks (e.g.,JADE), JS has
often abstract, agent behaviour and interaction model, that is a loose coupling to and low dependencies of the underlying
finally compiled to machine code for native host platforms execution platform. This is a significant advantage over
or virtual machines. The AAPL Programming Language is a JAVA or C programming languages, which must be always
common base for software and hardware implementations of compiled before the code can be executed, and being very
reactive agents supporting a wide range of agent processing sensitive for API and library mismatches. JS considers
and host platforms including microchip hardware designs functions as first-order values, enabling code reconfiguration
[12]. The latest extension of the agent platform family was on-the-fly like any other data modification using the built-in
the Agent Forth Virtual Machine (AFVM) fully implemented eval function.
in JavaScript including Browser implementations, which is
capable of executing agent code using a stack-based FORTH A. AgentJS: JavaScript for Agents
machine language with AAPL agent-specific extensions [7]. Textual representations used as an data and code inter-
The AFVM was optimized originally for low-resource en- change format is a prerequisite for data and code processing
247
in strong heterogeneous platform and network environments, are still visible), but it can be used to override higher scope
mixing big- and little endian machines, different data word level and global name qualifiers, and to invalidate references
sizes, and data codings. Though byte-code based interchange to free variables and functions without compromising other
formats are widely used, they require a strict compliance of agent processes or the JAM modules.
the coding between a sender and a receiver. At any time, a The agent process execution is an execution of a function
JS object can be converted to text in JSON format at run- with a strictly limited visible name space without any bind-
time. Originally, JSON was introduced for portable exchange ings to external and free variables and functions. To ensure
of JS data objects in a textual representation only, being this, the JSON parsing and evaluation is always performed
much more compact and easier to interpret than XML. A inside the with statement with a mask environment only
JAM/AgentJS agent is basically a JS object containing data providing a selected AIOS set of objects and functions,
(values, data objects, arrays) and functions, representing the discussed in the next sub-section. A creation of a new agent
agent activities and transitions of the ATG, requiring an will always first stringify the agent object, and finally coding
extended JSON text formatter and parser supporting func- back a sandboxed agent object free of any free and global
tions, which was introduced in JAM. An entire agent process object references, which can be executed the AIOS agent
can be converted at any time to the textual representation scheduler without any interference with the platform and
(JSON+) preserving its current control and data state, which other agents. This approach protects the agent execution
can be exchanged by different network and agent platform and JAM at least against failures by accident using common
nodes, and that is finally back converted to JS code. The JS coding styles. The capability of full intrusion protection
only existing limitation are circular (self) references inside depends on the JS VM environment itself.
of an object, which still cannot be handled, but not being
a real restriction. Transferring text instead of binary code C. AIOS: The Agent Execution and IO Environment
results in a significantly increased communication cost on The AIOS is the main execution layer of JAM. It consists
agent migration, but the text can be compressed reducing the of the sandbox execution environment encapsulating an
size significantly (experiments showed that LZ compressing agent process, with different privileged sub-sets depending
reduces the JSON+ text size and hence the communica- of the agent role (level 0,1,2). Furthermore, the AIOS module
tion costs about 5-6 times). Embedded devices can utilize implements the agent process scheduler and provides the
hardware compressor modules, e.g., using FPGA-based co- API for the logical (virtual) world and node composition.
processors, maximizing communication efficiency without The sandbox environment provides restricted access to a
additional CPU costs. code dictionary based on the privilege level, enabling code
exchange between agents.
B. AgentJS Sandbox Environment
Stability and robustness of the agent processing plat- D. Agent Scheduling and Checkpointing
form is one major challenge in the design of those plat- Unfortunately,JS has a strictly single-threaded execution
forms. Agents can be considered as autonomous or semi- model with one main thread, and even by using asyn-
autonomous processes and execution units. But this auton- chronous callbacks, these callbacks are executed only if the
omy requires strictly bounded and safe platform environ- main thread (or loop) terminates. This is the second hard
ments for the execution of agent processes, and the strict limitation of the execution of multiple agent processes within
isolation of agent processes from each other. An agent one JSJAM platform. Agents processes are scheduled on
platform must be capable to execute hundreds and thousands activity level, and a non-terminating agent process activ-
of different agent processes. Though there are extension ity would block the entire platform. Current JS execution
modules for some JS VMs (e.g., webworker) allowing the platform including VMs in WEB browser programs provide
execution of a JS program in a separate host process (or no reliable watchdog mechanism to handle non-terminating
thread), this method is not portable and is creates signif- JS functions or loops. Though some browsers can detect
icant overhead in time and memory space. Unfortunately, time outs, they are only capable to terminate the entire JS
JS has only a very limited scoping mechanism, basically program. To ensure the execution stability of the JAM and
limited to function closures and the this object, and with the JAM scheduler, and to enable time-slicing, checkpointing
one global space shared by all imported modules and must be injected in the agent code prior to execution. This
evaluated code. This limitation initially prohibits the safe step is performed in the code parsing phase by injecting a
and interference-free execution of multiple agent processes call to a checkpoint function CP() at the beginning of a
within one JS VM. But fortunately,JS provides the with body of each function contained in the agent code, and by
(mask){code} statement, executing the code with an injecting the CP call in loop conditional expressions. Though
additional new overlaid name space given by the mask this code injection can reduce the execution performance of
object argument. This cannot limit the name space scope the agent code significantly, it is necessary until JS plat-
(scopes are chained, and higher scopes like the global one forms are capable of fine-grained checkpointing and thread
248
scheduling with time slicing. On code-to-text transformation transformation, there cannot be any free variables inside an
(e.g., prior to a migration request), all CP calls are removed. agent object (the references would be lost on transformation
AIOS provides a main scheduling loop. This loop iterates and migration), including the commonly used self variable.
over all logical nodes of the logical world, and executes F. Agent Roles
one activity of all ready agent processes sequentially. If Security is another major challenge in distributed systems,
an activity execution reaches the hard time-slice limit, a especially concerning mobile agent processes. Each agent
SCHEDULE exception is raised, which can be handled by platform node (i.e, one physical VM, with multiple JAM
an optional agent exception handler (but without extending VMs operating on the same network node) can receive
the time-slice). This agent exception handling has only an agents originating either from inside trusting node networks
informational purpose for the agent, but offers the agent to or coming from untrusting networks not known by the
modify its behaviour. All consumed activity and transition VM. Generally, the VMs have no information about other
execution times are accumulated, and if the agent process network nodes except a sub-set of network connectivity
reaches a soft run-time limit, an EOL exception is raised. used to receive and propagate agent code. To distinguish at
This can be handled by an optional agent exception handler, least trusting and untrusting agents, different agent privilege
which can try to negotiate a higher CPU limit based on priv- levels were introduces, providing different AIOS API sets.
ilege level and available capabilities (only level-2 agents). Privilege level 0 is the lowest level and grants agents only
Any ready scheduling block of an agent and signal handlers computational and tuple-space IO statements. Level 0 agents
are scheduled before activity execution. After an activity are not allowed to replicate, to create or kill other agents, to
was executed, the next activity is computed by calling the send signals, and to modify their code. Level 1 agents can
transition function in the transition section. access the common AIOS API operations and capabilities,
In contrast to the AAPL model that supports multiple including agent replication, creation, killing, sending of
blocking statements (e.g., IO/tuple-space access) inside signals, and code morphing. Level 2 agents - the most
activities, JS is not capable of handling any kind of privileged - are additionally capable to negotiate (set) their
process blocking (there is no parallelism). For this desired resources on the current platform, i.e., CPU time
reason, scheduling blocks can be used in AgentJS and memory limits. An agent of level n may only create
activity functions handled by the AIOS scheduler. agents up to level n. Level-2 agents can initially only be
Blocking AgentJS functions returning a value use created inside the JAM. They can fork level-2 agents, but
common callback functions to handle function results, after a migration the destination node decides about the
e.g., inp(pat, function(tup){..}). A scheduling privilege level and can lower it, e.g., considering the agent
block consists of an array of functions, i.e., B(block)= source being not trustful. A migrated agent can get a higher
B([function(){..}, function(){..}, ..])., privilege level by negotiation, requiring a valid platform
executed one-by-one by the AIOS scheduler. Each function capability (see Sec. IV.) with the appropriate rights. After
may contain a blocking statement at the end of the body. migration, the privilege is lost and must be re-negotiated on
The this object inside each function references always a new platform using capabilities.
the agent object. To simplify iteration, there is a scheduling
loop constructor L(init,cond,next, block, finalize) G. The Execution Platform and Networking
The JAM execution platform consists of different virtual-
and an object iterator constructor I(obj, next, block,
ization layers. Each physical JAM node (a program executed
finalize), used, e.g., for array iteration.
on a host platform, e.g., a smart phone or server) has a log-
E. AgentJS-AAPL Relationship ical world consisting of logical nodes (at least one). Agent
AgentJS is a modified and restricted JS programming and processes are bound to and executed on one logical node at
object model, which can be directly executed by any JS any time. Logical nodes can be connected by using virtual
VM using the AIOS execution layer. The AAPL model can circuit links (queues), and physical.nodes can be connected
be directly mapped on this AgentJS model without further by using peer-to-peer network connections (sockets, IP links,
transformation steps, shown in Ex. 1. The only exception UART serial links, and so on) or the DOS layer introduced
is the decomposition of activities in scheduling blocks if in the next section. Agents can migrate between logical and
they contain blocking statements (e.g., line 12), except one physical nodes. The entire JAM(excluding DOS) platform
blocking tail-statement at the end of an activity, that do not requires about 600kB JStext code only.
require an an encapsulation in a scheduling block. Transition H. Agent Process Mobility and Migration
functions may not block, otherwise an exception is raised. The control state of an agent is stored in a reserved agent
Differing from common JS programs, the this object body variable next, pointing to the next activity to be
inside AgentJS activity, transition, callback, and first-order executed. The data state of an AgentJS agent consists only
function calls of AIOS provided functions is always bound to of the body variables. There are no references to variables
the agent object self reference! Due to the JSON+ code-text outside the agent process context. Migration requires a
249
ɨ ſřƀ ʰ ſřƀƇ
ɩ řśŚ ŜʰŚŜʰŚ
ɪ řśŚ ŜʰɥŚŜʰɥŚŜʰɥŚ
ɫ śŚ ŜʰɥŚŜ ʰŚ
ɬ ʰŜŜ Ŝ ʰƇ
ɭ Ś ś ſƀƇŜŜƈř
ɮ ʰ ś ſƀƇ
ɯ ſʰƀ śʰŚ ſŜʰʰƀŜ ʰŚ
ɰ ʫʫŚſƀŚŚ ƇŜʫʫŚſŜƀŚƈ
ɨɥ Ś ƈř
ɨɨ ʰ ś ſƀƇŚ
ɨɩ śŚſřţƀŚ ſƃ ſƀƇſƃŨŨřɏƄř ſƀƇʰƃɨƄƈƀř
ɨɪ śʰſʫƀŵɩŚ ſƀƇʰſʫƀŵɩƈƄƀŚ
ɨɫ Ś ƈř
ɨɬ ʰ ś ſƀƇ
ɨɭ ʰſƀŚ ŜʰſŜƀŚ
ɨɮ Ś ƈř
ɨɯ ʰ ś ſƀƇ
ɨɰ ſřƀŚſɛř ƀŚ ſƃŨŨřŜƄƀŚſſƀř ƀŚ
ɩɥ Ś ƈƈŚ
ɩɨ ſƀʰŜŜŚ ŜʰƇś ſƀƇŜŜƈŜŜƈŚ
ɩɩ ʰ ŜʰƇ
ɩɪ ŞʴŚ ś ſƀƇŨŨƈř
ɩɫ Şʴ ś Ś ś ſƀƇ
ɩɬ Şʴś ʴɥŚ ſŠŜ ƀŨ ŨŚ
ɩɭ Şʴś ʰɥŚ ſŜ ĺĺŜʴɥƀ
ɩɮ Şʴ śʰŚ ŨŨŚ
ɩɯ ŞʴŚ ſŜ ĺĺŜʰʰɥƀ
ɩɰ ŞʴŚ ŨŨŚ
ɪɥ ŞʴŚ ſʰʰƀŨ Ũƈř
ɪɨ Ś ś ſƀƇŨŨƈř
ɪɩ Ś ś ſƀƇŨŨƈƈŚ
ɪɪ ŜʰŨŨƈŚ
Ex. 1: A simple neighbourhood explorer agent programmed in AAPL (left) and the corresponding AgnetJS code (right). Note: In AgentJS this always
references the agent object, even in deeper context levels.
snapshot of the agent process, in this case the agent itself, a connected to any other JAM node.
code-to-text transformation, transportation of the text code
IV. T HE D ISTRIBUTED O RGANIZATION S YSTEM L AYER
to another logical or physical node, and a back text-to- In the simplest case JAM nodes are connected by peer-to-
code conversion with a new sandbox environment. The agent peer network links. But large-scale network environments
object is finally passed to the new node scheduler and can like the Internet are organized in hierarchical graph-like
continue execution. Text code sizes of medium complex structures with changing and transparent connectivity. To
agents (with respect to data and control space) are reasonable organize JAM nodes in such large-scale and heterogeneous
low about 10kB, simpler agents tend to 1kB, that can be networks, an additional Distributed Organization System
significantly reduced by using LZ compression. One draw- (DOS) layer is required. Furthermore, large-scale networks
back of this method raises with pending scheduling blocks introduce new issues in privacy, security, and trust, which
existing still in the snapshot. They must be entirely saved in must be addressed by the DOS.
the migrated snapshot, too, and back converted to code on The fundamental communication concept of the DOS-
the new node. Pending scheduling blocks contain function that is entirely implemented in JS (see [7] for details)- are
code and hence can increase the snapshot size significantly. Object-orientated Remote Procedure Calls (ORPC). They
Therefore, migration (using the moveto operation) requests are initiated by a client process with a transaction opera-
should not be embedded in a scheduling block. tion, and serviced by a server process by a pair of get-
I. SEJAM: The JavaScript Agent Simulator Environment request and put-reply operations, based on the Amoeba
Commonly, execution and simulation platforms are com- DOS [13]. Transactions are encapsulated in messages and
pletely different environments, and simulators are signifi- can be transferred between a network nodes. The server
cantly slower in the agent execution compared to real-world is specified by a unique port, and the object to be ac-
agent processing on optimized processing platforms. SEJAM cessed by a private structure containing the object number
is a MAS AgentJS simulator implemented on top of the JAM (managed by the server), a right permission field specifying
platform layer, executing agents with the same VM as a authorized operations on the object, and a second port
standalone agent platform would do. This capability leads to protecting the rights field against manipulation (see [13]
a high-speed simulator, only slowed down by visualization for details) using one-way encryption with a private port.
tasks and user interaction. Furthermore, multiple simulators All parts are merged in a capability structure [srvport]
can be connected via a stream link (sockets, IP links, etc.), obj(rights)[protport]. Capabilities are also used in
improving the simulation performance by supporting parallel this work for agent-agent platform negotiation, with a server
agent processing. Furthermore, the simulator can be directly port designating a platform or platform network. The rights
250
field can only changed with the original secret protection node.js/jxcore VM is optimized for x86 architectures. Tab.
port (otherwise protport is invalid). IV shows the agent context switch performance of the JAM
The integration and network connectivity of client-side scheduler, which is very fast. Again. the ARMv7 platform
application programs like Web browsers as an active agent under performs, but is still fast enough for mobile devices.
processing platform requires client-to-client communication Tuple space I/O adds only a small overhead, as shown in Tab.
capabilities, which is offered in this work by a broker server V. Finally, Tab. VI poses the minimal memory requirement
that is visible in the Internet or Intranet domain. To provide for a JAM node with a typical agent population. Commonly,
compatibility with and among all existing browser, node.js less than 32MB is required, confirming the suitability of JAM
server-side, and client-side applications, a RPC based inter- for low-resource embedded systems. The test agent classes
process communication encapsulated in HTTP messages used in this performance evaluation are explained in Sec.
exchanged with the broker server operating as a router was VI.
invented. Client applications communicate with the broker Creation of Agents Time/Agent +Memory/Agent
by using the generic HTTP client protocol and the GET and 100 1msa 2msb 2kBa 18kBb
PUT operations. RPC messages are encapsulated in HTTP 1k 1msa 2msb 3kBa 22kBb
10k 23msa 11msb 18kBa 18kBb
requests. If there is a RPC server request passed to the
broker, the broker will cache the request until another client- Table I: Test Case 1: Agent creation on a logical (virtual) node, simple
agent (text code size 0.9kB, five activities each with two statements, two
side host performs a matching transaction to this server port. variables and two parameters), memory: VM overhead/agent (heap+stack)
The transaction is passed to the original RPC server host in
the reply of a HTTP GET operation. Creation of Agents Time/Agent +Memory/Agent
There is a Directory and Name Server (DNS) providing 100 A:2msa 5msb 12kBa 131kBb
1000 A:2msa 5msb 91kBa 84kBb
a mapping of names (strings) on capability sets, organized 10000 A:3msa -b 81kBa -b
in directories. A directory is a capability-related object,
Table II: Test Case 2: Agent creation on one logical (virtual) node, complex
too, and hence can be organized in graph structures. DNS learner agent (agent text code size 10kB, two sub-classes: explorer, voter,
server can be distributed and chained in graphs, too. A total 20 activities, each with about 10 statements, 33 variables, and two
parameters), memory: VM overhead/agent (heap+stack)
capability set binds multiple capabilities associated with
the same semantic object, e.g., a file that is replicated on Initial Agents Migrations/ Migration+ +Memory/ Phys-
multiple file servers. Each directory contains rows and a set / logical node Agent Execution ical node
(total) (total) Time/ Agent
of columns for each row with different restricted row ca- 1 (4) 1k (4k) 1msa 4msb 28MBa 16MBb
pabilities enabling rights restriction and selection of objects 10 (40) 1k (40k) 1msa 4msb 26MBa 17MBb
and authorization key, e.g., used for agent role negotiation, 100 (400) 1k (400k) 1msa 3msb 70MBa 28MBb
privilege granting, code dictionary access. Column selection Table III: Test Case 3: Agent migration from one logical (virtual) node
can base on the agent privilege level. to a neighbour node, physical node with four logical nodes connected
in a ring, explorer agent (agent text code size 4kB), n agents on each
V. P LATFORM E VALUATION logical node, N circular migrations in the ring network two activity
executions/agent/migration, memory: VM overhead/agent (heap+stack)
The JAM platform was evaluated with different bench-
mark tests executed on different host platforms1 , in terms of Agents / log- Scheduled Scheduling +Memory/
Clouds low-resource, in terms of IoT mid-resource systems. ical node (to- Activities/ + Execution Physical node
Please note that the measurement results depend on the JS tal) Agent (total) Time/ Agent
1 (4) 20k (80k) 16μs 67μsb
a 5MBa 7 MBb
VM garbage collector algorithm and action at run-time. 10 (40) 20k (800k) 8μsa 33μsb 6MBa 9MBb
The creation (instantiation) or forking of new agents in- 100 (400) 20k (8M) 8μsa 29μsb 20MBa 9MBb
volves always a code-to-text and text-to-code transformation Table IV: Test case 4: Agent scheduling on four logical (virtual) nodes,
using the sandbox environment. The performance of this simple agent (text code size 1kB, five activities each with one statement,
two variables, and two parameters), memory: VM overhead/physical node
operation is shown in Tab. I and II, for a small and a (heap+stack)
complex agent class. Below 1000 agents/physical JAM an
agent creation requires about 1-5ms, and the memory over-
head is reasonable small. Migration requires the same code VI. U SE CASE : S TRUCTURAL M ONITORING
transformation, resulting in similar results, shown in Tab. Large scale perceptive and ubiquitous systems with hun-
III. The ARMv7 host platform under performs significantly dreds and thousands of devices require data processing
compared with the x86 platform. This has two reasons: The concepts far beyond the traditional centralized approaches.
ARMv7 processor has smaller code/data caches, and the Multi-Agent systems can be used to implement smart and
optimized sensor data processing in these distributed sensor
1 Test host platform a: Embedded System, Intel(R) Celeron(R) CPU
networks. In the following use case of a sensor network used
743 @ 1.30GHz, 2GB DRAM, node.js v0.10.36, Sun Solaris-11 OS, One
physical JAM with a JAM world consisting of four logical (virtual) nodes, for structural monitoring (e.g., of buildings, bridges, wind
connected in a grid (ring) with virtual circuit links (queues). Test host energy wings), different data processing and distribution
platform b: Smartphone, Toughshield R500+, 1GB DRAM, Android 4.1.2,
quad-core Arm Cortex A5, ARMv7-A, 1.2GHz, jxcore v.0.10.40 approaches are implemented with agents, shown in Fig. 3,
251
Agents / log- Scheduled Scheduling + +Memory/ 7HFKQLFDO 6WUXFWXUH
ical node (to- Activities/ IO Execution Physical node $JHQW
6HQVRU 1HWZRUN
tal) Agent (total) Time/ Agent
6HQVRU 1RGH /RDG
1 (4) 2k (8k) 31μsa 151μsb 4MBa 7MBb 2QOLQH 'DWD 3URFHVVLQJ
10 (40) 2k (80k) 28μsa 119 μsb 6MBa 7MBb 1HWZRUN &RQQHFWLRQ 0XOWL$JHQW 6\VWHP
100 (400) 2k (800k) 64μsa 217 μsb 26MBa 16MBb
Table V: Test case 5: Agent scheduling on four logical (virtual) nodes, sim-
ple agent with Tuple Space I/O (pairwise out/in in different activities)(text
code size 1kB, five activities each with one statement, two variables, and
two parameters), memory: VM overhead/physical node (heap+stack) 0RELOH &OLHQW
I /RDG 6WLPXOL
!
6WUDLQ 5HDFWLRQ
Agents / physical node VM Memory / physical node 2IIOLQH 'DWD
1 23MBa 25 MBb 3URFHVVLQJ 8VHU
10 24MBa 25 MBb N 6HQVRU 3URFHVVLQJ
100 31MBa 38 MBb
1000 104MBa 107 MBb 64/ , 0DFKLQH /HDUQLQJ
) V Vo I
Table VI: Test case 6: Lowest memory requirements in minimal JAM 6HUYHU &OLHQW
configuration (1 world, 1 node), agent creation on one logical (virtual) node,
complex machine learner agent (text code size 10kB, LZ compressed size
2kB, two sub-classes: explorer, voter, total 20 activities, each with about 10
statements, 33 variables, and two parameters), with VM parameter –max-
new-space-size=1024, total VM memory=heap+stack, after agent creation.
252
The Internet and WEB platform network is embedded in a
distributed co-ordination and management shell providing
an Object-Capability based RPC and global domain naming
and file services. The RPC communication is encapsulated
in generic IP/HTTP messages. A broker service is used to
connect IP client-side only applications like WEB browsers
or applications hidden in private networks, which are then
fully capable of client- and server-side RPC communication.
The evaluation of the JAM shows the performance metrics
and capability to process large-scale agent systems beyond
the 1000 agent limit with low overhead, and confirm the
suitability of JAM for low-resource embedded and mobile
devices. Each JAM node is capable to execute up to 1000
agents with reasonable speed. The entire JAM (excluding
DOS) platform requires about 600kB JS text code only,
suitable for embedded systems.
VIII. R EFERENCES
[1] M. Caridi and A. Sianesi, textitMulti-agent systems in produc-
tion planning and control: An application to the scheduling of
mixed-model assembly lines, Int. J. Production Economics, vol.
68, pp. 29−42, 2000.
[2] M. Pechoucek, V. Mar 0xed k, 2008. Industrial deployment
of multi-agent technologies: review and selected case studies.
Auton. Agent. Multi-Agent Syst. 17 (3), 397−431
[3] S. Bosse, A. Lechleiter, Structural Health and Load Mon-
itoring with Material-embedded Sensor Networks and Self-
organizing Multi-agent Systems, Procedia Technology, 2014,
DOI: 10.1016/j.protcy.2014.09.039
Figure 4: Temporal agent population in the example network during [4] M. Guijarro, R. Fuentes-fernández, G. Pajares, A Multi-Agent
learning (training) and classification phases (with 6 different load cases). System Architecture for Sensor Networks, Multi-Agent Systems
- Modeling, Control, Prog., Simulations and Applications, 2008.
nodes. Another case is cloud-based manufacturing with back [5] D. Lehmhus, T. Wuest, S. Wellsandt, S. Bosse, T. Kaihara,
propagation of sensor data gathered from products using K.-D. Thoben, and M. Busse, Cloud-Based Automated Design
and Additive Manufacturing: A Usage Data-Enabled Paradigm
AgentJS agents. Shift, Sensors MDPI, vol. 15, no. 12, pp. 32079−32122, 2015,
DOI 10.3390/s151229905.
VII. C ONCLUSIONS AND O UTLOOK [6] R. Milner, Communicating and mobile systems: theπ-calculus,
Large-scale distributed applications require a new process- Cambridge University Press, Cambridge (1999)
[7] S. Bosse, Unified Distributed Computing and Co-ordination in
ing and communication paradigm, which addresses scalabil- Pervasive/Ubiquitous Networks with Mobile Multi-Agent Sys-
ity, adaptability, self-organization, robustness, and resource tems using a Modular and Portable Agent Code Processing
constraints. In this work, agents are represented by mobile Platform, in The 6th International Conference on Emerging
Ubiquitous Systems and Pervasive Networks (EUSPN 2015),
JavaScript code (AgentJS) that can be modified at run-time Procedia Computer Science, 2015.
by agents and that are processed by a modular and portable [8] R. Milner, The space and motion of communicating agents.
agent platform JAM in a protected sandbox environment Cambridge University Press, 2009.
[9] L. Chunlina, L. Zhengdinga, L. Layuanb, and Z. Shuzhia,A
encapsulating agent processes. JAM provides ML as a ser- mobile agent platform based on tuple space coordination,
vice, splitting algorithms (platform) from model data (agent), Advances in Engineering Software, vol. 33, no. 4, pp. 215−225,
demonstrated with a structural monitoring use-case. JAM is 2002
[10] Z. Qin, J. Xing, and J. Zhang, A Replication-Based Distribution
implemented entirely in JS. The presented approach enables Approach for Tuple Space-Based Collaboration of Heteroge-
the development of perceptive clouds and smart systems of neous Agents, Research Journal of Information Technology, vol.
the future integrated in daily use computing environments 2, no. 4. pp. 201−214, 2010
[11] V. Di Lecce, M. Calabrese, and C. Martines, From Sensors to
and the Internet. Agents can migrate between different Applications: A Proposal to Fill the Gap, Sensors & Transduc-
host platforms including WEB browsers by migrating the ers, vol. 18, no. Special Isse, pp. 5−13, 2013.
program code of the agent, embedding the state and the data [12] S. Bosse,Design of Material-integrated Distributed Data Pro-
cessing Platforms with Mobile Multi-Agent Systems in Het-
of an agent, too, in an extended JSON+ format. Migration of erogeneous Networks, Proc. of the 6’th International Con-
agents create snapshots and code-text-code transformations, ference on Agents and Artificial Intelligence ICAART 2014.
which is executed with low latency as shown. The design DOI:10.5220/0004817500690080
[13] S. J. Mullender and G. van Rossum, Amoeba: A Distributed
and platform approach is suitable to cover the sensing, Operating System for the 1990s, IEEE Computer, vol. 23, no.
aggregation, and application layers of large-scale and mas- 5, pp. 44−53, 1990
sively distributed information processing systems efficiently.
253