This is just a random idea i had the other day.
Imagine a computer language that not only supports multithreading, but natively distributes operations among multiple threads.
Code like this:
Could automatically be compiled into
for i := a ... b
x[i] = f(i)
This will enable the program to do calculations while waiting for blocking I/O operations to finish, be it user typing or reading from the harddrive:
for i := a ... (a-b)/2
for i:= 1+(a-b)/2 ... b
x[i] = f(i)
Here, x = f(x) will be started in a different thread, so that f(x) can run while y := readln blocks to wait for input.
x := readln
x = f(x)
y := readln
y = f(y)
Separating tasks into different threads will become more and more important -- both AMD and Intel's upcoming processors will have multiple cores which gives multithreading an advantage over single-threading.
Does a computer language like this exist? It's very easy to create threads in Java, for example, but it still requires manual construction and control.
Ada seems to have something called 'tasks' as well, which apparently could be mapped to threads.
I would imagine that a compiler like this would have to be quite intelligent though, to be able to estimate the gains versus the overhead to create a new thread (a thread pool could be used, but there'll still be overhead).