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: 66% (21 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.
-
The following information relates to Grigg plc: 1 On 1 April 19 X8 the company had \( 100,00010\) per cent debentures in issue. The interest on these debentures is paid on 30 September and 31 March....
-
Sunny Valley Resort has owned 80 percent of Mountain Lodging, Inc. since Mountain Lodging's inception. The condensed consolidated balance sheets of Sunny Valley Resort at December 31, 2017 and 2016...
-
Analysis of Given Ratios Robbins Company is a wholesale distributor of professional equipment and supplies. The company?s sales have averaged about $900,000 annually for the 3-year period 2009?2011....
-
Required information [The following information applies to the questions displayed below.] Marcelino Co.'s March 31 inventory of raw materials is $81,000. Raw materials purchases in April are...
-
Consider the following three CPU organizations: CPU SS: A 2-core superscalar microprocessor that provides out-of-order issue capabilities on 2 function units (FUs). Only a single thread can run on...
-
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....
-
The record for the worlds loudest burp is 109.9 dB, measured at a distance of 2.5 m from the burper. Assuming that this sound was emitted as a spherical wave, what was the power emitted by the burper...
-
A retail store that offers home movie theaters, sound systems, and furnishings, sells many of its items on credit. What might this company do to discourage slow payers from delaying paying their...
-
How do leaders balance the pursuit of short-term financial performance objectives with long-term sustainability goals, stakeholder value creation, and corporate social responsibility imperatives to...
-
Equipment in Andy's Auto Body Repair Shop was completely destroyed by an explosion due to a natural gas leak ignited by a welding torch. The adjusted basis of the equipment was $250,000. The...
-
Citing a failure to comply with state regulations regarding the registration of corporations, State subpoenas Nonprofit Environmental Organization demanding a list of its members. Nonprofit...
-
What are the key considerations for leaders when formulating and executing mergers and acquisitions as part of inorganic growth strategies, including target identification, due diligence, post-merger...
-
Write equations to represent the following observations. (a) A mixture of Mg(OH) 2 (s) and Zn(OH) 2 (s) is treated with NH 3 (aq). The Zn(OH) 2 dissolves, but the Mg(OH) 2 (s) is left behind. (b)...
-
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...
-
The clutch used in mopeds is (a) single plate clutch (b) multi-plate clutch (c) cone clutch (d) centrifigal clutch
-
Define predication and predicated execution.
-
Define control speculation.
-
What is the purpose of the NaT bit?
-
Tides are considered a predictable source of energy because they rise and fall periodically: Group of answer choices due to the Coriolis effect due to the topography of the bottom of the ocean due...
-
Which statement below accurately states why most winds form? Multiple choice question. Air released by plants must displace the existing air around the plant, which in turn sets up a chain reaction...
-
(a) A circular cylindrical liquid jet of diameter, D, spontaneously breaks down into spherical droplets of diameter, d. Show that the minimum possible d/D = 1.5 due to surface tension/energy. (b)...
Study smarter with the SolutionInn App