Multithreaded computer language

This is a discussion on Multithreaded computer language within the A Brief History of Cprogramming.com forums, part of the Community Boards category; This is just a random idea i had the other day. Imagine a computer language that not only supports multithreading, ...

  1. #1
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072

    Multithreaded computer language

    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:
    Code:
    for i := a ... b
    x[i] = f(i)
    Could automatically be compiled into
    Code:
    //Thread 1
    for i := a ... (a-b)/2
    x[i]= f(i)
     
    //Thread 2
    for i:= 1+(a-b)/2 ... 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:
    Code:
    x := readln
    x = f(x)
    y := readln
    y = f(y)
    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.

    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).
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I've seen a programming language made primarily for designing circuits. It automatically made as much stuff as possible run at the same time, somehwhere on the chip.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. upgrade computer ?
    By teeyester in forum Tech Board
    Replies: 4
    Last Post: 10-11-2003, 09:51 PM
  2. Regarding Undergraduate Computer Majors
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-04-2003, 11:55 AM
  3. Fun Learning a New Language
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-30-2003, 10:03 PM
  4. Computer engineering - programming.
    By Unregistered in forum C Programming
    Replies: 10
    Last Post: 07-15-2002, 02:37 PM
  5. computer sex
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 09-17-2001, 07:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21