The purpose of this project is to familiarize yourself with the design and implementation issues of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The purpose of this project is to familiarize yourself with the design and implementation issues of a user- level thread package on PC/Linux. You need to use the tar command with the options xvfz to uncompress and extract files from "cis620s/pub/xt.tar.gz to your working directory. Part I The thread package which we discussed in the class is non-preemptive. That is, a thread can run to comple- tion unless it yields the control to other threads. For the first part of this assignment, you need to make the threads preemptive. You can use signal and ualarm to provide a clock interrupt every 0.01 second. When the clock interrupt occurs, the interrupt handler suspends the current running thread and finds a runnable thread to run. On PC/Linux, you need sigemptyset, sigaddset, and sigprocmask to unblock the SIGALRM signal to allow the next SIGALRM delivered. Add more comments to the source code. Part II You also need to enhance the thread library with the event mechanism. The events are declared as variables with a data type xthread_event_t. The following three functions have to be implemented: void xthread_init_ev (xthread_event_t *e); The event pointed by e is initialized as NOT_OCCURRED when xthread_init_ev () is invoked. void xthread_wait_ev (xthread_event_t *e) ; The function xthread_wait_ev () will place the calling thread on a queue of threads if the event pointed by e has not occurred. Otherwise, the calling thread continues to execute and the event is set to be NOT_OCCURRED. void xthread_set_ev (xthread_event_t *e) ; When a thread does a xthread_set_ev() operation on the event pointed by e, ALL of the waiting threads are allowed to continue processing and the event will be reset to NOT OCCURRED. If there are no queued processes, the event will be set as OCCURRED. Note that if the SIGALRM occurs during the execution of thread creation/completion, event wait/set, etc., the process table may lead to an inconsistent state (why? Give an example in your report). To solve this problem, you can use usec ualarm (0,0); ualarm (usec, 0); to disable the timer interrupt at the function entrance and restore it before the function returns. 1 Turnin Each group (two students) has to submit your report and program electronically. You have to put your report file (i.e. report.pdf) under the xt dir. Before you submit, you need to use make clean to clean all of the object/executable files. Then, on grail, change the directory to the parent directory of the xt dir and use the following command to submit the whole xt dir: turnin -c cis620s -p proj2 xt Your report should include the description of your code, the thread state transition diagram, experiences in debugging and testing, the project status (working or not), etc. The cover page should contain your pictures, names and the login id you used to turnin the project. Start on time and good luck. If you have any questions, send e-mail to j. sang@csuohio.edu. The purpose of this project is to familiarize yourself with the design and implementation issues of a user- level thread package on PC/Linux. You need to use the tar command with the options xvfz to uncompress and extract files from "cis620s/pub/xt.tar.gz to your working directory. Part I The thread package which we discussed in the class is non-preemptive. That is, a thread can run to comple- tion unless it yields the control to other threads. For the first part of this assignment, you need to make the threads preemptive. You can use signal and ualarm to provide a clock interrupt every 0.01 second. When the clock interrupt occurs, the interrupt handler suspends the current running thread and finds a runnable thread to run. On PC/Linux, you need sigemptyset, sigaddset, and sigprocmask to unblock the SIGALRM signal to allow the next SIGALRM delivered. Add more comments to the source code. Part II You also need to enhance the thread library with the event mechanism. The events are declared as variables with a data type xthread_event_t. The following three functions have to be implemented: void xthread_init_ev (xthread_event_t *e); The event pointed by e is initialized as NOT_OCCURRED when xthread_init_ev () is invoked. void xthread_wait_ev (xthread_event_t *e) ; The function xthread_wait_ev () will place the calling thread on a queue of threads if the event pointed by e has not occurred. Otherwise, the calling thread continues to execute and the event is set to be NOT_OCCURRED. void xthread_set_ev (xthread_event_t *e) ; When a thread does a xthread_set_ev() operation on the event pointed by e, ALL of the waiting threads are allowed to continue processing and the event will be reset to NOT OCCURRED. If there are no queued processes, the event will be set as OCCURRED. Note that if the SIGALRM occurs during the execution of thread creation/completion, event wait/set, etc., the process table may lead to an inconsistent state (why? Give an example in your report). To solve this problem, you can use usec ualarm (0,0); ualarm (usec, 0); to disable the timer interrupt at the function entrance and restore it before the function returns. 1 Turnin Each group (two students) has to submit your report and program electronically. You have to put your report file (i.e. report.pdf) under the xt dir. Before you submit, you need to use make clean to clean all of the object/executable files. Then, on grail, change the directory to the parent directory of the xt dir and use the following command to submit the whole xt dir: turnin -c cis620s -p proj2 xt Your report should include the description of your code, the thread state transition diagram, experiences in debugging and testing, the project status (working or not), etc. The cover page should contain your pictures, names and the login id you used to turnin the project. Start on time and good luck. If you have any questions, send e-mail to j. sang@csuohio.edu.
Expert Answer:
Answer rating: 100% (QA)
Answer Heres a highlevel overview of the tasks you need to perform for Part I and Part II Part I Pre... View the full answer
Related Book For
Research Methods For Business Students
ISBN: 9781292208787
8th Edition
Authors: Mark Saunders, Philip Lewis, Adrian Thornhill
Posted Date:
Students also viewed these programming questions
-
Compare and contrast ROR using different definitions of airport assets, including revenue generator, public service, safety, and security infrastructure.
-
what ways do post-translational modifications, such as acetylation and phosphorylation, intricately regulate metabolic enzymes to fine-tune metabolic flux and coordinate cellular responses to...
-
Case Analysis Critical thinking, creativity, and problem-solving are among some of the top skills needed by employers in the supply chain industry. This assignment will stretch your critical...
-
Each table of values gives several points that lie on a line.(a) What is the x-intercept of the line? The y-intercept?(b) Which equation in choices AD corresponds to the given table of values?(c)...
-
Figure P36.72 shows a thin converging lens for which the radii of curvature are R1 = 9.00 cm and R2 = -11.0 cm. The lens is in front of a concave spherical mirror with the radius of curvature R =...
-
What are recombinant chromosomes? How do they differ from the original parental chromosomes from which they are derived?
-
The mean wages for a sample of employees in a company was \($18.00\) per day with a standard deviation of \($2.50\) per day. Between what two values do 95% of the data lie? (Assume the data set has a...
-
The marketing manager for a chain of hardware stores needed more information about the effectiveness of the three types of advertising that the chain used. These are localized direct mailing (in...
-
5) Find the derivative and simplify your answer: y = 2x x - 3x+1
-
If the population of Botswana is 2 million and is increasing at 2% per annum, what will be the population in 10 years time? 2. Express (3,-2) as polar co-ordinates, correct to 2 decimal places, in...
-
In this post, you will provide your answer to the following: Part 1 Read the scenario and discuss your thoughts about it by providing your answer to the questions listed below. Scenario: Training...
-
What will be the output of the below code in a Unix-based system: using System; using System. Runtime. InteropServices; [DllImport ("libc", SetLastError = true)] private static extern int getpid ();...
-
How would you swap two numbers without using a third variable? Explain
-
Description Bring it all together! 1. Make a connection between the False Memory and Cannabis research and your own life. 2. Make a connection between Loftus's False Memory research and your own...
-
We can even write numbers based on these systems of casino chips. Say that abcReno means you have a red chip, b blue chips, and c white chips. (For example, 123Reno means 1 red chip worth 25, 2 blue...
-
Clarify the difference between isoquants and indifference
-
Give the structural formulas of the alkenes that, on ozonolysis, give: a. (CH3)2C=O and CH2=O b. Only (CH3CH2)2C=O c. CH3CH=O and CH3CH2CH=O d. O=CHCH2CH2CH2CH=O
-
What are the principal ethical issues you will need to consider irrespective of the particular research methods that you use?
-
The following extract and associated references are taken from the first draft of a critical literature review. The research project was concerned with the impact of changes to UK legal aid...
-
In relation to your proposed research project, evaluate your scope to use: a. A traditional approach; b. An Internet- or intranet-mediated approach; c. A hybrid access strategy to gain access to...
-
Consider the Gompertz model in Eq. (12.35). Graph the expectation function for \(\theta_{1}=1, \theta_{3}=1\), and \(\theta_{2}=\frac{1}{8}, 1,8,64\) over the range \(0 \leq x \leq 10\). Equation...
-
Consider the following observations: a. Fit the nonlinear regression model \[ y=\theta_{1} e^{\theta_{2} x}+\varepsilon \] to these data. Discuss how you obtained the starting values. b. Test for...
-
Consider the model \[ y=\theta_{1}-\theta_{2} e^{-\theta_{3} x}+\varepsilon \] This is called the Mitcherlich equation, and it is often used in chemical engineering. For example, \(y\) may be yield...
Study smarter with the SolutionInn App