Programming Homework Help

Programming Homework Help. pthread Keio Debug Code

CHANGE FILE TO .C TO START DECODING

1. it prints out the wrong thread name, usually K, instead of the desired ABCDEFGHIJK. To fix this, a) turn that into a global variable instead of a local one that’s on the stack of main(), then b) fix it to always, reliably have the right name when mythread() reads the argument it is called with. There are lots of ways of doing this.

2. gcounter ends up wrong, even though in this case each thread actually locks the global counter before updating it. It turns out the problem is in the initialization of lcounter, as you can see from the printout above: the local work being done by each thread is the wrong amount! This is another initialization bug in the startup code for the thread. Fix this. Again, there are a number of ways of doing this.

One elaborate but good way of doing this is for main() to use malloc() and to create a data structure for each separate thread to use.

Programming Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"