Download pseudo source code

procedure main:
  declare constant message_capacity = 512
  declare message as an array of message_capacity of char initialized with \
    "Hello from main thread of process " + process_number \
    + " of " + process_count + " on " + process_hostname

  if process_number != 0 then
    send(message, length(message), 0)
  else
    print(process_number, " sent ", message)
    for source := 1 to process_count do
      receive(&message, message_capacity, source)
      print(source, " sent ", message)
    end
  end if
end procedure