What is the naming conventions for pthread function calls?

Assignment Help Biology
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.

Reference no: EM132326832

Questions Cloud

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.

Reviews

Write a Review

Biology Questions & Answers

  Immune response to infectious disease

It is a very curcial concept to understand how the immune response is mounted against viruses, bacteria, protozoans and helminthes. For an effective immune response, both innate and adaptive immunity should work together.

  A review on advanced glycated end products (ages)

This Project report elaborates a critical review of important elements attached to Advanced Glycated End Products (AGEs). It is very crucial to understand the process called Millard reaction.

  Plastic as a soil stabilizer

Soil stabilization is the permanent physical and chemical alteration of soils to enhance their physical properties. Stabilization can increase the shear strength of a soil and control the shrink-swell properties.

  Principles of microbiology

This assignment has three parts which contains questions related to Microbiology. It contains basic principles of microscopy, staining techniques in microbiology and microbial growth in the food industry.

  List the biologic functions

Lipid metabolites are often seen as key elements in cellular signaling. Is this unique? Please provide several examples of the function of lipids as key elements in signal arrays and list the biologic functions these signals affect?

  Biologic function relationships

Please describe how one might search for chemical structure, biologic function relationships, involving small molecular weight lipophylic compounds. Provide one example.

  Case study on patient in the haematology laboratory

Write a case study which detailing a scenario of a patient being investigated in the Haematology laboratory.

  Use of pcr and genetic approaches in biotechnology

The use of PCR and genetic approaches in biotechnology

  Describe the role of this enzyme in honey

Glucose oxidase is an enzyme that can be used for measurements of glucose levels by combining this reaction with an oxygen probe.

  Genetic problems

What phenotypic ratio would you get if you crossed a white mouse and a heterozygous brown mouse?

  Prepare an essay on nosocomial infection

Prepare an essay on nosocomial infection.

  Monitoring and recording the blood pressure

To increase the awareness of monitoring and recording the blood pressure of patients and practice measuring blood pressure in a safe environment.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd