14-Concurrent_Programming_II - CSC 4304 Systems Programming...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 4304 - Systems Programming Fall 2010 Tevfik Ko ! ar Louisiana State University November 2nd, 2010 Lecture - XIV Concurrent Programming Concurrency Issues 2 Concurrency Issues 3 4 Synchronization Mechanism that allows the programmer to control the relative order in which operations occur in different threads or processes. Critical Section 5 Busy Waiting 6
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Suspend and Resume 7 Mutual Exclusion 8 Mutual Exclusion: Problem 1 9 Mutual Exclusion: Problem 2 10 Mutual Exclusion: Problem 2 11 Mutual Exclusion: Problem 3 12
Image of page 2
Mutual Exclusion: Problem 3 13 Mutual Exclusion: Solution 14 POSIX Threads: MUTEX int pthread_mutex_init( pthread_mutex_t *mutex , const pthread_mutexattr_t *mutexattr ); int pthread_mutex_lock( pthread_mutex_t *mutex ); int pthread_mutex_unlock( pthread_mutex_t *mutex ); int pthread_mutex_destroy( pthread_mutex_t *mutex ); a new data type named pthread_mutex_t is designated for mutexes a mutex is like a key (to access the code section) that is handed to only one thread at a time the attribute of a mutex can be controlled by using the pthread_mutex_init() function the lock/unlock functions work in tandem 15 MUTEX Example #include <pthread.h> ...
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern