EDAN26 Multicore Programming Lab 3

Course home page is here.

The purpose of this lab is to introduce you to C and Pthreads and understanding how the following factors impact how well a program is suitable for a multicore machine:

  1. Fetch the file swish.c for instance using the command:

    wget fileadmin.cs.lth.se/cs/Education/edan26/labs/lab3/swish.c

  2. This is a sequential program which models a number of swish transactions. Your first task is to parallelize it using Pthreads. When you have done that, change the THREADS macro to something suitable for the machine you use (e.g. to the number of cores).

  3. As you can see in the work function, swish transactions are always from one account to a different account, which both makes sense and simplifies Pthreads usage. Change this by removing the do and while.

    Does your program still work? If not, why?

    Change the initialization of the mutex to allow recursive mutexes.

  4. Try next to determine how much extra processing is ''required'' to make the multicore version relatively faster than the single-threaded version? Modify the PROCESSING macro for this. What can the reason for this be? Should not the multicore version be faster?

  5. What is the effect of varying the number of accounts on performance and what can the reasons for this be? Modify the ACCOUNTS macro for this.

  6. How varies the TPS (transactions per second) between an X86 machine (your laptop, probably, or an LTH lab machine, compared to the POWER machine?



Mon Sep 23 08:35:32 CEST 2019