class list. public: list. -list int add (int 6 time stamp double & temperature,
ID: 3784569 • Letter: C
Question
class list. public: list. -list int add (int 6 time stamp double & temperature, double windspeed) int display int displayTemp int displayWind int checkTime (int & timestamp) i int checkTemp (double & temperature) int checkwind (double & windspeed) private: int time; double temper double wind: struct node list, linked; node nexts; node nextT; next class datalogger public: datalogger -datalogger windspee int (int & timestamp double & temperature double 6 int print Report private: node heads: node head Ti headW: node tempHead;Explanation / Answer
Utilizing one bolt for the whole rundown would totally vanquish most purposes behind multithreading in any case. By securing the whole show, you ensure that just a single string can utilize the rundown at once.
This is absolutely protected as in you will have no halts or races, however it is innocent and wasteful in light of the fact that you serialize access to the whole rundown.
A superior approach is have a secure for every thing in the rundown, and another for the rundown itself. The last would be required when annexing to the rundown, contingent upon how the rundown is executed (eg, in the event that it keeps up a hub check seperate from the hubs themselves).
However this may likewise be not as much as ideal relying upon various components. For example, on a few stages mutexes may be costly as far as assets and time while instantiating the mutex. On the off chance that space is at a premium, another approach may be to have a settled size pool of mutexes from which you attract at whatever point you have to get to a thing. These mutexes would have some sort of proprietorship banner which demonstrates which hub they are allotted to, so that no other mutex would be dispensed to that hub in the meantime.
Another system is to utilize peruser/compose locks, which will permit read access to any string, yet compose access to just a single, the two being fundamentally unrelated. In any case it has been proposed in the writing that much of the time utilizing a peruser/compose bolt is quite effective than basically utilizing a plain mutex. This will rely on upon your real utilization example and how the bolt is actualized
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.