[Question]
  [
I have a challenge for you:
* Print "Hello World" using any language.
* Each character must be printed from its own, unique thread
That's it. Obviously, as there's no guarantee that the threads will operate in the order you start them, you have to make your program thread safe to ensure the output is printed in the right order.
And, because this is code golf, the shortest program wins.
**Update:**
The winner is [Marinus' APL entry](https://codegolf.stackexchange.com/a/5886/4139), at 34 characters. It also wins the prize for the least readable entry.
  
[Answer]
## C, 61 62 chars
```
i;main(){write(1,"Hello World\n"+i++,1);i>13||fork()||main();}
```
The pthread library functions all have loooooong names, so instead I fired up an entire separate process for each character. `fork()` is so much shorter.
It was necessary to use `write()` instead of `putchar()` because the stdio buffering functions are not thread-safe.
**Edited**: Back up to 62 chars. In my zeal, dropping down to 61 chars also dropped the thread-safety.
[Answer]
## APL (Dyalog) (~~44~~  ~~43~~ ~~39~~ 34)
```
{⍞←⍺⊣⎕DL⍵}&⌿2 11⍴'Hello World',⍳11
```
Explanation:
* `2 11⍴'Hello World',⍳11` creates a matrix: (H,1), (e,2), ...
* `&⌿` means: for each column of the matrix, do on a separate thread:
* In a thread, `⍺` is now the character and `⍵` is now the time
* `⎕DL⊃⍵` waits for `⍵` seconds.
* Then, `⍞←⍺` outputs the character.
[Answer]
### Ruby, 46 characters
```
"Hello World".chars{|c|Thread.new{$><<c}.join}
```
It is synchronized due to the fact that the program waits for the thread to end before starting the next thread and continuing with the next char.
[Answer]
# Pythonect (35 chars)
<http://www.pythonect.org>
```
"Hello World"|list|_.split()->print
```
[Answer]
## Python (~~101~~ ~~93~~ 98)
This is Peter Taylor's solution. It works by delaying printing the N-th character by N seconds. See comments.
```
import sys.threading as t
for x in range(11):t.Timer(x,sys.stdout.write,"Hello World"[x]).start()
```
This is the original one:
```
import sys,threading as t
for x in "Hello World":t.Thread(None,sys.stdout.write,x,x).start()
```
It worked because the time it takes to print a single character is less than the time it takes Python to initialize a new thread, therefore the N-th thread would finish before the N+1-th thread was created. Apparently it is against the rules to rely on this.
[Answer]
# C# 73
```
"hello world".ToList().ForEach(c=>Task.Run(()=>Console.Write(c)).Wait());
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 28 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Full program. Prints to stderr. Inspired by [marinus' solution](https://codegolf.stackexchange.com/a/5886/43319).
```
'Hello World'{⍞←⍺⊣⎕DL⍵}&¨⍳11
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94L@6R2pOTr5CeH5RTop69aPeeY/aJjzq3fWoa/GjvqkuPo96t9aqHVrxqHezoSFIw38FMCjggtBgNQqGRgqPeucqpKTmJFaCOMWpyfl5KcUKaflFCiUZqQqJSfllqQol@QppmXmZxRkA "APL (Dyalog Unicode) – Try It Online")
`⍳11` first 11 integers
`'Hello World'{`…`}&¨` for each integer as right argument (`⍵`), spawn the following function with the corresponding character as left argument (`⍺`):
 `⎕DL⍵` **d**e**l**ay right-argument seconds
 `⍺⊣` discard that (the effective delay) in favour of the left-argument character
 `⍞←` print that to stdout without trailing line break
[Answer]
## Java (160 chars)
```
class A{static int i;public static void main(String...a){new Thread(){public void run(){System.out.print("Hello World".charAt(i++));if(i<11)main();}}.start();}}
```
Yeah, I know this is the wrong language for code golf, I do it for fun.
[Answer]
## Bash (64)
```
:(){ [ "$1" ]&&(echo -n "${1:0:1}"&: "${1:1}")};: "Hello World"
```
[Answer]
## Haskell (~~120~~ 118)
```
import Control.Concurrent
t=threadDelay.(*3^8)
main=(\(x,y)->forkIO$t x>>putChar y)`mapM_`zip[0..]"Hello World">>t 99
```
I'm not all that sure about multiplying by 9999 - I have a 2Ghz Xeon on which it'll work fine even if you don't, but I also have a Pentium 4 that needs it (999 gave garbled output and 99 didn't do anything at all.)
[Answer]
### scala(~~81~~ 79 chars)
```
def?(l:String){if(l.size!=0)new Thread{print(l(0));?(l.tail)}}
?("Hello World")
```
[Answer]
# Groovy, 51 characters
```
"Hello World".each{a->Thread.start{print a}.join()}
```
[Answer]
## D (135 chars)
```
import std.concurrency,std.stdio;
void main(){
    p("Hello World");
}
void p(string h){
    write(h[0]);
    if(h.length>1)spawn(&p,h[1..$]);
}
```
I only start the next thread when I have already printed the current char
edit +2 chars for better bound check
[Answer]
### Scala 74
```
"Hello World".zipWithIndex.par.map(x=>{Thread.sleep(x._2*99);print(x._1)})
```
* zipWithIndex produces ((H, 0), (e, 1), (l, 2) ...).
* par makes it a parallel collection.
Tests:
```
(1 to 10).foreach {_ => "Hello World".zipWithIndex.par.map(x=>{Thread.sleep(x._2*99);print(x._1)});println()}
Hello World
Hello World
Hello World
...
Hello World
```
[Answer]
## Javascript (72)
```
(function f(){console.log("Hello world"[i++]);i<11&&setTimeout(f)})(i=0)
```
[Answer]
### scala(45)
Thread#join based solution
```
"Hello World"map{x=>new Thread{print(x)}join}
```
or
```
for(x<-"Hello World")new Thread{print(x)}join
```
[Answer]
This is my F# attempt. My first serious F# program. Please be kind.
```
let myprint c = async {
        printfn "%c"c
}
"Hello World"|>Seq.map myprint|>Async.Parallel|>Async.RunSynchronously|>ignore
```
[Answer]
## [Go](http://golang.org/)
```
package main
import"fmt"
func main(){o:=make(chan int)
for _,c:=range"Hello World"{go func(c rune){fmt.Printf("%c",c)
o<-0}(c)}
for i:=0;i<11;i++{<-o}}
```
[Answer]
# Erlang (90)
```
-module(h).
r()->r("Hello World").
r([])->'';r([H|T])->spawn(h,r,[T]),io:format("~c",[H]).
```
Compile `erlc +export_all h.erl`
[Answer]
## Nimrod, 121
```
proc p(c:char){.thread.}=write(stdout,c)
for c in "Hello World":
 var t:TThread[char]
 createThread(t,p,c)
 joinThread(t)
```
[Answer]
## Python: too many characters, but it works.
```
# Ok. First we patch Threading.start to test wether our solution actually works
import threading
import random, time
original_run = threading.Thread.run
def myRun(self):
    tosleep = random.randint(0,200)/1000.0
    time.sleep(tosleep)
    original_run(self)
threading.Thread.run = myRun
# And now the real code:
import time, sys, threading
string_to_write = "Hello World\n"
current_char_index = 0 # This integer represents the index of the next char to be written
# It will act as a semaphore: threads will wait until it reaches
# the index of the single char that particular thread is due to output
class Writer(threading.Thread):
    def __init__(self, char_to_write, index_to_write):
        self.char_to_write, self.index_to_write = char_to_write, index_to_write
        super(Writer, self).__init__()
    def run(self):
        ch = globals()['current_char_index']
        while not self.index_to_write == ch:
            time.sleep(0.005)
        sys.stdout.write(self.char_to_write)
        # This will be atomic because no other thread will touch it while it has "our" index
        globals()['current_char_index'] += 1
for i, char in enumerate(string_to_write):
    Writer(char, i).start()
```
[Answer]
### C# ~~90~~ 84
```
foreach(var c in"Hello World"){var t=new Thread(Console.Write);t.Start(c);t.Join();}
```
Running version: <http://ideone.com/0dXNw>
[Answer]
**Objective-C (183 characters)**
```
-(void) thread {[self performSelectorInBackground:@selector(printC) withObject:nil];}
-(void) printC {char *c = "Hello World"; for(int i = 0; c[i] != '\0'; i++) {printf("%c", c[i]);}}
```
[Answer]
## Haskell 99 Characters
```
import Control.Concurrent
f[]=return()
f(x:xs)=(putChar x)>>(forkIO$f xs)>>f[]
main=f"Hello World"
```
How it works is each thread starts the next after having displayed its character, so they actually useful stuff can not happen out of sequence.
[Answer]
# [Bash](https://www.gnu.org/software/bash/), 43 bytes
```
xargs -n1 printf<<<'H e l l o \  W o r l d'
```
[Try it online!](https://tio.run/##S0oszvj/vyKxKL1YQTfPUKGgKDOvJM3GxkbdQyFVIQcI8xViFBTCgVQRkJOi/v8/AA "Bash – Try It Online")
`xargs` forks a separate `printf` process for each character (and waits for it to exit).
# [Bash](https://www.gnu.org/software/bash/), 45 bytes, no external utilities
```
eval \(printf\ {H,e,l,l,o,\\\ ,W,o,r,l,d}\)\;
```
[Try it online!](https://tio.run/##S0oszvj/P7UsMUchRqOgKDOvJC1GodpDJ1UnBwjzdWJiYhR0woGMIiA3pTZGM8b6/38A "Bash – Try It Online")
Expands to `(printf H); (printf e); (printf l); (printf l); (printf o); (printf \ ); (printf W); (printf o); (printf r); (printf l); (printf d);` before evaluation. The parentheses make Bash fork a subshell for each letter (and wait for it to exit), but this time `printf` is the Bash builtin.
]