Home CPSC 401

Looking Forward


Language Trends

Looking at the future, there are a few trends that seem to be prevalent:


Concurrency refers to a program executing more than one computation simultaneously.

Below is graph of the clock speed of Intel processors from the 70's until 2006:

What happened around 2001?

In order to increase the speed of a program in the multi-core era, we need some type of parallelism in our programs.


Types of Parallelism

The burden of parallel programming is chiefly sharing data while keeping them synchronized when needed.

It's possible that parallelism will be more important in future programming languages.



Chapel is an imperative-style language developed for concurrency by Cray.

It has parallelism as part of the semantics of the language.

It adds new keywords such as forall:

var array : [1..1000000] int = 0;
var c : int = 100;

forall i in 1..1000000 {
  array[i] += C;

A forall loop is similar to a for loop, except that a for loop guarantees that the iterations will be done in order.

A forall loop produces a thread for each core, and does the iterations in parallel.

Chapel also provides begin statements which launches a thread to perform a statement asynchronously:

begin function1();
begin function2();
begin function3();

There is also the cobegin statement which launches a set of statements asynchronously, then waits for them all to finish:

cobegin {
  begin function1();
  begin function2();
  begin function3();

function4 does not run until the others have completed.

Chapel also provides built in locking data types and common operations such as reductions.


GPGPU Languages

Graphics cards have gotten more powerful and flexible to the point where many applications can run better on the GPU than the CPU.

Each GPU runs much slower than a CPU, but is much more scalable.

Commodity cards have hundreds of processing elements, and high-end ones have thousands.

There are two main systems geared for GPGPU, both based on the C programming language:

Parallel Functional Programming

Functional programming works well with parallel programming. One major difficulty is synchronizing changing data.

Languages that minimize changing data make this easier.

In Haskell, because functions cannot produce side-effects, they are relatively easy to parallelize.

Google's MapReduce model is based on the higher order functions map, and filter (which is also called reduce).

Several languages focused on parallelism are in the functional family including:


Automatic Parallelization

Automatic parallelization is the ability of compilers to read in sequential code and parallelize it for us. It has been an active area of research, but compilers can currently only do this in very specific scenarios.

One simple place compilers due this is in vectorization. Modern processors provide single instructions that operate on multiple data elements at once. For example, instructions exist to add multiple 8-byte values packed into a 64-bit register.

Compiler optimizations also exist to automatically create threads for iterations of loops, but they typically only work for embarrassingly parallelizable loops.

The general problem of automatically parallelizing code is an open problem.


C++ 11 and 14

All popular languages continue to evolve. The latest version of C++ came out in 2011 and contains many new features:

C99 and C11

C has also has had some revisions. C99 added the following features:

C11 also adds some new features:


Java 8

Java 8 was released in 2014. The biggest new feature is lambdas.

The syntax for this is as follows:

(param1, param2) -> expression
For example, we can specify an add function as follows:

(a, b) -> a + b
We can also have a body with statements:

(param1, param2) -> {stmt1; stmt2...}
For example:

(a, b) -> {int result = a + b; return result;}

Lambdas also make higher-order functions more seamless, and Java 8 includes several in the standard library. For example, a map in Java 8 might look like:

List<Integer> result =  Arrays.asList(1, 2, 3, 4, 5)
.map(x -> x * x)

Other changes including a Javascript interpreter so applications can be extended, and several standard library changes.


Mixing Languages

One trend in programming languages is to write programs using multiple languages. Some reasons for this:



New languages in the future may be quite different. However, old languages are still used.

There are many jobs still available for COBOL programmers.

Still it is important to keep up with trends in programming languages:

Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.