News

Downloads

Training Courses

How are plans scheduled and how many threads does JACK® use itself?

Within a single JVM, all JACK® agents are (normally) executed by just one thread. JACK includes a time based scheduler, which ensures that all agents get a slice of execution. On top of that, each JACK agent can have many tasks pending at the same time so each agent can specify its own task manager. This provides the task execution

policy for that agent. The default is for the agent to stay committed to a task as long as possible.

Each JACK plan is transformed by the compiler into steps in a finite state machine which can be executed by an agent's task manager. The executing thread may leave the plan (task) and come back to it later, and then continue progressing the plan (task) later.

Thus, JACK has only one thread. Plus an additional one for receiving messages.

In many applications, the code within an agent is "java interface code", which may be invoked by threads other than the JACK scheduling thread. (The message receiving thread is an example of such a thread).