Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will write your first parallel program using pthreads. This program should be invoked as follows: ./minions k The above line means

For this assignment, you will write your first parallel program using pthreads. This program should be invoked as follows: ./minions k The above line means the users typed in the name of our test program ./minions and gave it one command line argument. This program will spawn k threads. Each thread will print Hello! I am minion x to stdout. x is a unique number from 0 to k 1 representing the thread ID, e.g. the first thread created will be minion 0. All of these threads should run concurrently. Once all the threads have terminated, create an additional thread that says: Hello Minions! I am the Overlord!. You should create a Makefile that can compile your program on Centaurus. Your program needs to run on Centaurus. You should submit a slurm batch file that executes your program with 40 threads.

Your threads output may overwrite each other. This is normal; we have not discussed race conditions yet. However, the Overlord should print last. Make sure the Overlord is a new thread and not the main thread. Assumptions and Errors Your program should ensure that threads are created properly. If pthread create fails, print Failed to create pthread, error code X. You should print the returned error code in place of X, and also exit with the same error code.

Your archive should include these files only: minions.c Makefile README slurm.out README should include a small description of what difficulties you had in this project. A slurm.out file produced by slurm. This file will be created automatically with a slightly different name when you submit a job with sbatch. This will demonstrate that you tested/ran your code at least once. Create your own Makefile. Follow good compilation standards. Your Makefiles MUST produce a compiled executable named minions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Explain the two meanings that the term equality can have.

Answered: 1 week ago