Contact

Feel free to drop me a message for any stupid mistakes I’ve made.

One comment

  1. Sir,
    In a programming assignment I have asked to implement Test and Set lock, with POSIX threads… Each thread will execute the following code..
    —————————————————
    register int p, q, i, j; // Thread-local
    BARRIER(…); // Start measuring time here
    for (i=0; i<N; i++) {
    ACQUIRE(…);
    for (j=0; j<K; j++) {
    q++;
    }
    RELEASE(…);
    for (j=0; j<M; j++) {
    p++;
    }
    } // End measuring time here
    a[MyID*FALSE_SHARING_AVOIDING_PAD] = p+q; // This is to make sure that the compiler
    // does not optimize away the entire code.
    ———————————————————
    could you please help me in implementing the AQUIRE and RELEASE function using "cmpxchg".. I am naive in this …
    Thanking You,
    -Debjyoti Paul

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s