Reference no: EM132326832
1. POSIX threads
In all the following questions include a short answer and on which man page you found the information.
1) What is the naming conventions for pthread function calls?
2) Enumerate the synchronization mechanisms for POSIX threads?
3) Why is it a good programming practice to call pthread_cond_wait from within a loop?
4) Which thread executes after a thread is woken up from a condition variable.
5) What happens if a thread blocks on a condition variable while holding two mutexes.
6) What is a detached thread.
2. Probabilistic Analysis of Pthreads.
In this assignment you will write two pthreads programs that evaluate some aspects of the pthreads system. The first and simpler of the two, lets threads write to the same file using mutexes to avoid race conditions. The main thread creates N (N is an optional command line argument by dafault 100) threads and all of them immediately block on condition variable start_line. After all threads are created, the main thread wakes them up and then waits until they all terminate with join. The threads after waking up lock the mutex filemut and write their TID followed by newline to file pthread_stats and then release the mutex. After they do this M times each (the second optional command line argument that defaults to 1000) they join the main thread. In the second pthread program of the assignment the main program creates N threads designated as red and then another N threads designated as green. All of them immediately block on condition variable start_line.
After all threads are created, the main thread wakes them up and then waits until the all terminate with join. The threads after waking up lock the mutex filemut and write their TID followed by the word red or green followed by newline to file pthread_stats. The difference in this second version is that all the red threads write first their TID M times releasing and re-acquiring the mutex, then all the green ones another M times, then the red threads again, and so on, until they hav e alternated L (another optional command line argument that defaults to 10)
times each for a total 2×M×N×L lines in the file pthread_stats (or 2×M×L lines per thread).
1. Both programs accept optional arguments. The first one is N, the second one is M and the third one (applies only to the second program) is L.
To do the analysis write a small program in C, AWK, or python (I strongly recommend AWK but python is also OK) to calculate the mean and standard deviation of the "runs". A run is the number of consecutive writes by the same thread.
The three sources of evidence based practice
: Compare, contrast, and critique the three sources of evidence based practice, e.g., research evidence, professional expertise, and community beliefs.
|
Critique the three sources of evidence based practice
: Compare, contrast, and critique the three sources of evidence based practice, e.g., research evidence, professional expertise, and community beliefs.
|
Conclude about the risk of deodorant causing cancer
: What did your group conclude about the risk of deodorant causing cancer? Did you agree or disagree with members in your group?
|
Keep track of what triggers you eating for few days
: Why do you eat what you do? Keep track of what triggers you eating for a few days. Does the world around influence what you select to eat?
|
What is the naming conventions for pthread function calls?
: What is the naming conventions for pthread function calls? Which thread executes after a thread is woken up from a condition variable.
|
Effect cognitive processes into our understanding of emotion
: How did the Schater-Singer Theory introduce the effect cognitive processes into our understanding of emotion? why racial differences are found in IQ scores?
|
The problem and propose one public health intervention
: Describe the magnitude of the problem and propose one public health intervention (education, outreach, screening, etc.) to address the problem.
|
National collegiate athletic association
: The National Collegiate Athletic Association (NCAA) now screens all Division I and II athletes for sickle cell trait. What is the premise for this testing?
|
Compare the genomic aspects of different plasmodia
: Compare the genomic aspects of different Plasmodia and may be correlate them to some phenotypes (diseases) based on their structure.
|