Thread Scheduler and Concurrency.

Sharing Time (Illusion of concurrency).

Any number of threads(running programs) can be coordinated using Thread Scheduler. It is responsible for communicating with each thread and allowing it to proceed with one step, or for specified quantum of time, or until interrupted, for example by passing a token to it. When the thread is done with it's job, it passes token back. Then scheduler proceeds with next thread in queue (or ring).

True concurrency may be achieved with multiple processors.

But once we have concurrency mechanism, how we coordinate threads?

Tokens (preconditions) might be accumulated by entry mechanism, then when all preconditions are met, thread might be allowed to run. (To appear in Thread Scheduler's queue). Multiple tokens might be joined by boolean operators, to allow for conditionality. (for example: precondition A is met when precondition B is met or when precondition C is met).

Communication must be arranged to avoid (or overcome) problems of concurrency, such as Mutual Exclusion, Dining Philosophers, Readers and Writers, Producers and Consumers.

Passing tokens

Events are useful in this model of synchronization.


Stitie Machine 1.1 'Sunsail'.

Stitie Machine 1.1.35 RC 0-0-5 'Sunsail' implementation is available.

(RC stands for: 'Release Candidate', Alpha means 'feature incomplete', Beta means 'feature complete, to be tested').

What is this code about?

it's an experiment with Information Technology.
i've tried to help as many as possible in shortest time guided by insight. that's how it was formed into existence.
it's a technology that can solve certain 'problems' better than others, and at solving other 'problems' is worse.
it's incomplete still, and aimed to truly shine at certain point in future - when processors & memory are cheaper.
it's pointless to develop tech that exploits modern computers because by the time it's complete there are better computers already.

'Stitie Space', 3D Objects Matrix data structure, has certain unique 'convenience methods' that allow for a 'fine manipulation of objects' in 'computer memory', a space to be filled with numbers in itself, perhaps ...

these numbers belong to a usual set of {0,1} that is found in 'Computer Sciences' ...

any 'number' or 'other data' can be represented with proper amount of these numbers ...

Stitie Space's 'convenience methods' include:
- MATEN functionality,
- Prism functionality,
- Finite State Objects,
- Conditionality & Events,
- Mindful Imaging functionality.
- perhaps more ...

for more, see if You wish or need, ... : Agile Transformation of Information State.

perhaps in future this will allow to control clouds of robots of different scales.

it's unfinished high level prototype of 3D Objects Matrix, that allows for fine manipulation of objects in space (in computer memory).

MATEN Form functionality is a certain form invocation in space.

controlled robots will be able to (perhaps) take different geometrical forms in space & 'update' software via upload from matrix.

if robots are so small that not visible to eyes, then it can seem that form materializes in space & transforms space.

such a miracle from machine (Deus Ex Machina).

i'd call it 'Pseudomaterialization'.

i've planned (this can change) to implement election algorithm to choose 'task-givers' to groups of robots, for example in a case of failures.

not only that.

Main Features List:

* Stitie Machines (State, Strategy, Router) forming 3-Dimensional Stitie Space (3D Objects Graph that looks like cube of objects connected properly). Let's note that (State + Strategy) is equivalent of an Object as in Object Oriented Programming. Router is a tool that can be used to move States & Strategies to other coordinates. Executing a strategy after moving at certain coordinates is also possible with Router objects.
* MATEN functionality (Certain Form Invocation in Space).
* PRISM transformation. It will transform space taking set of Coordinates and LightPoints at such as input. 'colorful points of light in space will be split and transform space'.
* LightPoints. Point of Light is (State, Strategy) pair, an equivalent of an Object. (color is determined by state and strategy pair, strategy determines also changes in color; color includes lighting).
* Mindful Imaging Prototype (depends on JOGL).

Sitite Machine version 1.1 'Sunsail' is considered closed, only allowable changes from now on are error-fixing.

Work will continue in Stitie Machine 1.2 'Satellite' & perhaps in Stitie Machine 1.3 'November Rain'.


Notes for MATEN functionality:

It's a Maneuver in Space. We'll add Maneuvers to Space and name them. Then invoke MATEN function with a Maneuver's name as a parameter, which will return Space to 'zero' state then invoke that Maneuver. Or will do magic that will result in something equal but more efficient. Result of executing a Maneuver is a new Form.

Example code, for preparing for a MATEN invocation:


    MATENManeuverStrategy mms1 = new MATENManeuverStrategy(
      new EmptyManeuverStrategy(),
      new DefaultZeroManeuverStrategy(matrixA));

    matrixA.addMATENManeuverStrategy("emptyForm", mms1);

Code above adds an 'empty form invocation maneuver' to a Space (which is a '3D Matrix' in this case).

This 'empty form' on Matrix A can be invoked like that:


When invoked, default zero maneuver strategy will be called if space is not in the 'zero state'. If called, it will return space to the 'zero state'. Then empty maneuver strategy will be used, which will do nothing. In the end we'll have an empty form, space is in the 'zero state'.


Basic (without graph or other magic involved) functionality implemented.

Current implementation of MATEN functionality is not erroneous, we do not want to store last MATEN maneuver... we wish to allow for changes after executing such. Return maneuver must be abstract enough to allow for all situations that are considered. There will be default most abstract return maneuver implementation but we wish to allow for better solutions as well. In certain situations we won't want to just empty all states and strategies, we wish to store them for transformation as input data for later, Invocation maneuver. It's best done with new programming language: 'Ola AH', for concurrency is an issue for now.

For now we have 'Default Zero Maneuver Strategy' that returns space to the 'Zero State', where strategies and states are empty, without remembering strategies/states from previous Form.

There might be concurrency errors if MATEN is used carelessly (this can be solved with new language: 'Ola AH', or theoretically with hacks - we do not want such). Hack is something done not according with design.


Some more tests:

Test #1: Stitie Space.

Quite slow for low resolution. (in truth, not so low because it's three-dimensional - but it's still slow).

after > 64 'pixels' resolution there are troubles, perhaps not enough memory - i didn't check very well.

optimization can proceed as follows:

- perhaps parts of Stitie Space can be optimized algorithmically. thinking about Strategies, Maneuvers, etc... not guaranteeing anything. still fairly cheap programmer time-wise.
- we can have low level optimization (both for Stitie Space & Code of Program that uses Stitie Space). very expensive programmer time-wise.

Test #2: JOGL/JogAmp.

seems that JOGL is quite fast & light, it should stay if it's not too expensive (seems to be free for now). we do not need any layer above.

perhaps 'Ola AH' Programming Language can use OpenGL as well, we'll see. certainly not as only option, there should be also option for direct graphics coding.


Dependencies used:

should work with Linux as well; i've used Stitie Space 'Sunsail' 1.1 with Linux / JogAmp before.

i didn't care (yet) about using minimal library set, it's not time for that.... perhaps files content will change with time anyway.

branch of Stitie Machine 1.1 'Sunsail' became basis for a Game Engine, which will be ported to ANSI C for speed (low-level optimization).

it looks like a Stitie Machine 1.1 'Sunsail' will be included in semantics of 'Ola AH' Programming Language.

See also if You wish or need, ... : Stitie Machine (Maszyna Stanikowa Wysockiego), High-Level Prototype, Low-Level Port, Parallel & Distributed Systems, Stitie Space, Stitie Space, Form & Emptiness.


Joining and Transforming Properties

When Joining or Transforming properties, we should use 3 methods:

Collection joinPropertiesAllowingSplit(Object property1, Object property2, ...)
Object joinPropertiesByTransforming(Object property1, Object property2, ...)
Object transformProperty(Object property)

First method allows, as it's name says, allows to separate properties after they have been joined.

Second method allows to join multiple properties forming new object with properties derived from input properties.

Thrid method allows to transform single property into another property.

Distributed Transmission

Any number (note that any object's state can be represented as number) can be written as series, sum of prime number multiplications (See Factor Prime post). Serie can be transformed (compressed, reduced), then each of prime numbers and operations can be numbered, quantified, and sent via different channels (routes), then joined at the destination.

This way large number (or object) can arrive at destination more securely and quicker. In case of channel (for example internet connection between two computers) being sniffed (overheard by hacker), the sniffer does not have complete information. It is quicker because data is compressed, and each part trasmitted concurrently via separate channel.

Code can also be transmitted, just like any other information, executable or not. (We can generate intermediate code or use available notation, for example java .class files, transmit, then parse it at destination. We can use reflection to generate objects dynamically).

Implementation of Distributed Transmission will be available in this blog later on.

See also: Splitting and Joining Information Flow.


Taylor Series

In mathematics, a Taylor series is a representation of a function as an infinite sum of terms that are calculated from the values of the function's derivatives at a single point.

The Taylor series of a real or complex-valued function ƒ(x) that is infinitely differentiable in a neighborhood of a real or complex number a is the power series:

f(a)+(f '(a) / 1!)*(x-a) + (f ''(a) / 2!)*(x-a)2 + (f(3)(a) / 3!)*(x-a)3 + ...

It is common practice to approximate a function by using a finite number of terms of its Taylor series. Taylor's theorem gives quantitative estimates on the error in this approximation. Any finite number of initial terms of the Taylor series of a function is called a Taylor polynomial. The Taylor series of a function is the limit of that function's Taylor polynomials, provided that the limit exists. A function may not be equal to its Taylor series, even if its Taylor series converges at every point.

As the degree of the Taylor polynomial rises, it approaches the correct function.


How to precisely count using computers.

You can write number in form of fractions of numbers factored into primes.

Then define operations on fractions (for example mutliplication of two fractions is done via multiplications: numerator by numerator and denominator by denominator).

This way we can write precisely large numbers in form of fractions, and if we need to reduce fraction into number we can do it with least number of error-prone operations.