Information

Author(s) Erik-Jan Lingen, Matthias Möller
Deadline No deadline
Submission limit No limitation

Sign in

[Threads] Exercise 1 : Hello World

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Task

Implement a program that spawns eight threads, each of which prints its identifier three times.

Use the function sleep to pause one second after each printed line:

for ( i = 0; i < 3; i++ ) {
  printf ( "I am thread ...\n" );
  sleep  ( 1 );
}

Question 1: Hello World
Question 2: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.