Lab 8

Here is the lab writeup:

And here is Bilal's CUDA code that you will be using:

2009/11/30 21:18 · Jeffrey Knockel

Notes for Pre-Thanksgiving

Here are my notes and files for my lecture on 11/20/09 on stack smashing:

Bilal's lectures on CUDA on 11/23/09 and 11/25/09 were derived from these notes:

2009/11/30 10:20 · Jeffrey Knockel

Lab 7

Lab 7 is a makeup of Lab 5.

lab7.pdf

2009/11/16 10:08 · Jeffrey Knockel

Lab 6 -- Another Test

One of the tricky things with race conditions is that your code can seem to consistently work on some occasions or machines but not on other occasions or machines. This is because, if the thread you intended to go first just-so-happens to always win a race condition when you test it (for whatever reason), then it may appear that that thread is guaranteed to always go first and that there is no race condition. But, we can try to force a thread–perhaps one that we may not have expected to go first–to try to go first by using a sleep() call in another thread.

If you think that you have fixed the original pthreads code, try your solution out on the code directly below. This may reveal a problem with your solution. I have introduced a sleep() to help the consumer thread to win a race condition that may still exist in your code.

pthreads-bad3.c

2009/11/12 15:36 · Jeffrey Knockel

Lab 6

Here is the writeup:

Here is the bad, not thread-safe code referenced in the writeup:

Here is some sample bad output from the bad code on a single processor system:

2009/11/09 10:28 · Jeffrey Knockel

Class Notes for Week Ending 11/6/09

By popular request, and since many of you have never seen a goto before, here is how to write a for loop using only if's and goto's:

#include <stdio.h>

int main( void )
{
    int i;
#if 0
    for (i = 0; i < 64; ++i) {
        printf ("%x\n", 0xdeadbeef >> i);
    }
#endif
    i = 0;
loop:
    if (i >= 64) {
        goto loop_break;
    }
    printf ("%x\n", 0xdeadbeef >> i);
    ++i;
    goto loop;
loop_break:
    return 0;
}

Also, here is a link to the latest (as of this posting) revision of the C99 standard:

http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf

It is the real McCoy and is more comprehensive than the K&R book, although less user friendly.

2009/11/04 22:49 · Jeffrey Knockel

Older entries >>

Back to top
start.txt · Last modified: 2009/10/10 17:46 by jeffk