The Concurrent Programming Language: Cind

  • Time:2020-09-17 14:26:24
  • Class:Weblog
  • Read:27

What is concurrent programming and and why does it matter?

There are many definition of concurrent programming, but basically concurrent programming is the name of programming few threads that works simultaneously on the same memory.

Today’s devices are ready for concurrent programming, because almost every processor has number of cores, that may work independently.
Concurrent algorithms (that are algorithms that resolves problems by assigning tasks to concurrently worked threads) opens up a world of new possibilities.

Many problems, such as sorting, compression, decoding, etc., if it there is a possibility to use more processors, could be done faster with concurrent algorithms, than by conventional ones, that uses only one processor.

Concurrent programming is not so easy at it seems to be, because it brings us a range of own problems, that arise during code designing,
such as synchronization of working threads, methods for access shared data, locks implementation, atomic instructions, and so on.

Concurrency in programming languages

Almost every modern language has a possibility to the concurrent programming. Ones use own language syntax, the others uses special external libraries or other techniques to allow to build concurrently working code.

For example in the Java language starting concurrent thread may be done by implement a class that extends from a Thread class, and then calls run method:

1
2
3
4
5
6
public class A extends Thread {
   // ...
   public void run() {
       // code of thread ...
   }
}
public class A extends Thread {
   // ...
   public void run() {
       // code of thread ...
   }
}

and then calling:

1
2
   A a = new A();
   a.start();
   A a = new A();
   a.start();

will create an object of class A and starts its thread. That thread will work concurrently to the main code and may access the same variables simultaneously with the other threads.

There are many concurrent programming languages, even concurrent version of pascal and basic, but in all of this languages playing with concurrency requires a significant amount of coding, because they were not originally designed for concurrent programming.
Looking for a language in which concurrent programming is as easy as it should be, I have found Cind.

Cind language

cind-programming The Concurrent Programming Language: Cind multithreading programming languages

cind-programming


Cind language is an easy language, designed specially for concurrent programming. Getting the point, to start two concurrent threads one can simply separates them by a hash character, simply write:

1
{# ... thread 1 ... # ... thread 2 ... }
{# ... thread 1 ... # ... thread 2 ... }

The sample piece of code:

1
2
3
4
  int x = 0;
  {# x++;
   # x--;
   # host.println(x); }
  int x = 0;
  {# x++;
   # x--;
   # host.println(x); }

starts three threads, one of them increments value in the variable x, the second one decrements it, and the third prints them out. At the output we get one of three possible values: -1,0,1. It is not deterministically specified which of the value will be printed out because it is not known in what order and in which interlacing the threads will be made. And that’s the beauty of concurrent programming.

Delving into the Cind language, it has a great semantics for concurrent programming. The concurrent threads may be fired almost everywhere in the code, which makes a completely new approach to the programming.

There are also a special type of class named “selector” of which objects can accept incoming methods in the time and order they want to. (this construction cannot be found anywhere else).
For example:

1
2
3
4
5
6
7
8
class selector S {
    start() {
        int x;
        accept put(y) { x = y; }
        x++;
        accept get() { return x; }
    }
}
class selector S {
    start() {
        int x;
        accept put(y) { x = y; }
        x++;
        accept get() { return x; }
    }
}

object of class S will firstly wait for incoming call put, (at this time any other call sent to the object will be suspended and waits for an acceptance from the object), and after got it, it will accept get message to return incremented value.

In addition to the concurrent programming, Cind language has a semantics to the regular programming, including data types, language statements, classes, functions, and so on, which looks fairly simple. It is quite new language, firstly released in 2019, so it has a small programming environment and extensions (currently I found two external libraries to call mathematical functions and to work with internet connections). But it seems to be very forward looking.

And also, in my surprise, the compiler and runtime environment of Cind language are very fast. I can confidently recommend a Cind language, for those who take their first steps in concurrent programming and also to develop advanced concurrent algorithms.

–EOF (The Ultimate Computing & Technology Blog) —

Recommend:
Critics of Japan’s Handling of the Cruise Ship Coronavirus Quara
Tips for Starting a Car-Themed Blog
How to Build a Popular, Trustworthy Blog
6 Simple Ways to Promote Your Blog
The Secret to Writing More Compelling Blog Titles
5 Habits Of Highly Successful Bloggers
5 Ways to Connect Your Blog Content Writers
Google’s Perfect World: A New Technical SEO Framework
Boost the Visibility of Your Blog With In-Person Events
Are Top 20 Witnesses Voting Each Other? Introducing Witness-voti
Share:Facebook Twitter
Comment list
Comment add