Figure is a listing of code intended for use on the eCos kernel. a. Explain the operation
Question:
a. Explain the operation of the code. Assume thread B begins execution first and thread A begins to execute after some event occurs.
b. What would happen if the mutex unlock and wait code execution in the call to cyg_cond_wait, on line 30, were not atomic?
c. Why is the while loop on line 26 needed?
Transcribed Image Text:
1 unsigned char buffer_empty true; суд mutex t mut cond var; 3 cyg cond-t cond_var; 5 void thread af cyg_ addrword t index ) 7 while 1 run this thread forever // acquire data into the buffer... 10 // there is data in the buffer now 12 13 14 15 16 17 18 19 20 21 22 void thread b cyg addrword t index ) 23 24 while 1 /run this thread forever 25 26 27 28 29 3 0 31 32 buffer-empty false; cyg mutex lock f &mut cond var cyg cond signal cond var ) суд.-mutex-unlock( &mut-cond-var ); суд, mutex-lock ( &mut. Cond-var while ( buffer_empty true) cyg-cond-wait( &cond-var ); ); // get the buffer data. 34 35 36 37 38 39 4 0 // set flag to indicate the data in the buffer has been processed buffer empty truei cyg mutex unlock ( &mut cond var // process the data in the buffer 4 2 43
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 70% (20 reviews)
a This listing is an example using a condition variable Thread A is acquiring data that are processe...View the full answer
Answered By
Nimlord Kingori
2023 is my 7th year in academic writing, I have grown to be that tutor who will help raise your grade and better your GPA. At a fraction of the cost on other sites, I will work on your assignment by taking it as mine. I give it all the attention it deserves and ensures you get the grade that I promise. I am well versed in business-related subjects, information technology, Nursing, history, poetry, and statistics. Some software's that I have access to are SPSS and NVIVO. I kindly encourage you to try me; I may be all that you have been seeking, thank you.
4.90+
360+ Reviews
1070+ Question Solved
Related Book For
Operating Systems Internals and Design Principles
ISBN: 978-0133805918
8th edition
Authors: William Stallings
Question Posted:
Students also viewed these Computer Sciences questions
-
The Fortune E-50 is a listing of the top 50 electronic commerce and Internet-based companies, as determined by Fortune magazine each year. Fortune groups the companies into four categories: (1)...
-
What would happen if it turned out that RPM did not have a legitimate reason for stopping payment on the check? RPM Pizza, Inc., issued a check for $96,000 to Systems Marketing for an advertising...
-
What would happen if the C curve had shifted down only half as much as curve C in Figure 6.3?
-
Ginter Co. holds Kolar Inc.s $10,000, 120-day, 9% note. The entry made by Ginter Co. when the note is collected, assuming no interest has been previously accrued, is: (a) Cash Notes Receivable (b)...
-
Describe what a super class and a subclass represent.
-
A router using DVMRP receives a packet with source address 10.14.17.2 from interface 2. If the router forwards the packet, what are the contents of the entry related to this address in the unicast...
-
Consider the simple linear regression model fit to the solar energy data in Problem 2.3. Problem 2.3 Table B. 2 presents data collected during a solar energy project at Georgia Tech. a. Construct a...
-
Kaizer Plastics produces a variety of plastic items for packaging and distribution. One item, container #145, has had a low contribution to profits. Last year, 20,000 units of container #145 were...
-
HomeLife Life Insurance Company has two service departments (actuarial and premium rating) and two production departments (advertising and sales). The distribution of each service department's...
-
A 55,000 kW thermal power plant of NPC delivers an annual output of 283,000 MWHr with a peak load of 44 MW. The annual load factor of the plant is nearest to?
-
The implementation of mutexes within the eCos kernel does not support recursive locks. If a thread has locked a mutex and then attempts to lock the mutex again, typically as a result of some...
-
The discussion of eCos spinlocks included an example showing why spinlocks should not be used on a uni-processor system if two threads of different priorities can compete for the same spinlock....
-
Strain is the ratio of: (a) Change in volume to original volume (b) Change in length to original length (c) Change in cross-section area to original cross-section area (d) All of the above
-
How does amortization of lease and well equipment such as storage tanks and separators differ under the three methods? Include in your answer a discussion of the method used, including which reserves...
-
Reconsider the experiment in Problem 5-22. Use the Box-Cox procedure to determine if a transformation on the response is appropriate (or useful) in the analysis of the data from this experiment....
-
How does the tax depletion of leasehold costs differ from successful efforts or full cost depletion? Include in your answer a discussion of the reserves used (proved reserves or proved developed...
-
How does amortization of drilling costs differ under the three methods? Include in your answer a discussion of the method used, which reserves are used, if any, and which drilling costs are...
-
In the grill defects experiment described in Problem 8-29, a variation of the square root transformation was employed in the analysis of the data. Use the Box-Cox method to determine if this is the...
-
Liabilities that are to be settled within 12 months are termed as ____________.
-
Write a while loop that uses an explicit iterator to accomplish the same thing as Exercise 7.3. Exercise 7.3. Write a for-each loop that calls the addInterest method on each BankAccount object in a...
-
Define predication and predicated execution.
-
Define control speculation.
-
What is the purpose of the NaT bit?
-
As a precaution, the levers on gasoline pumps in many provinces in Canada must be manually operated at all times. One of the reasons for this is especially relevant in the winter time because the...
-
7. A transformer core is shown in cartoon form in Figure 8.26. This is made up of, perhaps implausibly, 29 gage M-36 laminations: the same sort of material described by Figures 8.19 and 8.20. Assume...
-
2. For a lamp that has a total luminous flux, of 4.5104 lm and total radiant flux, of 300 W, (a) what is the overall luminous efficiency, K for this lamp? (b) if this lamp has a luminous intensity of...
Study smarter with the SolutionInn App