1 / 16

cs205: engineering software university of virginia fall 2006

cs205: engineering software university of virginia fall 2006. Concurrency on Mars. Kramer Sharp. JavaSpaces. Tuple Space Operations. write ( t ) – add tuple t to tuple space take ( s )  t – returns and removes tuple t matching template s

jguzman
Télécharger la présentation

cs205: engineering software university of virginia fall 2006

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. cs205: engineering software university of virginia fall 2006 Concurrency on Mars Kramer Sharp

  2. JavaSpaces

  3. Tuple Space Operations • write (t) – add tuple t to tuple space • take (s)  t –returns and removes tuple t matching template s • read (s)  t – same as take, except doesn’t remove t. Operations are atomic (even if space is distributed)

  4. Distributed Ebay • Offer Item (String item, int minbid, int time): write (item, minbid, “owner”); sleep (time); take (item, formal bid, formal bidder); if (bidder  “owner”) SOLD! • Bid (String bidder, String item, int bid): take (item, formal highbid, formal highbidder); if (bid > highbid) write (item, bid, bidder) else write (item, highbid, highbidder) How well would this work?

  5. Factorial Setup: for (int i = 1; i <= n; i++) write (i); repeat n – 1 times: start FactTask FactTask: take (int i); take (int j); write (i * j); Eventually, tuple space contains one entry which is the answer. What if last two elements are taken concurrently? Better way to order Setup?

  6. Finishing Factorial Setup: for (int i = 1; i <= n; i++) write (i); write (“workleft”, n - 1); take (“workleft”, 0); take (result); FactTask: take (“workleft”, formal w); if (w > 0) take (int i); take (int j); write (i * j); write (“workleft”, w – 1); Opps – we’ve sequentialized it!

  7. Concurrent Finishing Factorial Setup: repeat n-1 times: start FactWorker out (“done”, 0); for (int i = 1; i <= n; i++) { write (i); if i > 1 write (“work”); } take (“done”, n-1); take (result); FactWorker: take (“work”); take (formal int i); take (formal int j); write (i * j); take (“done”, formal int n); write (“done”, n + 1);

  8. Sorting in Linda • Problem: Sort an array of n integers • Initial tuple state (“A”, [A[0], ..., A[n-1]]) • Final tuple state: (“A”, [A’[0], ..., A’[n-1]]) such A’ has a corresponding element for every element in A, and for all 0 <= j < k <= n-1, A’[j] <= A’[k] Challenge Problem (50 bonus points)

  9. Mars Pathfinder Landed on Mars, July 4, 1997 Sojourner Rover

  10. New York Times, 15 July 1997 Mary Beth Murrill, a spokeswoman for NASA's Jet Propulsion Laboratory, said transmission of the panoramic shot took “a lot of processing power.” She likened the data overload to what happens with a personal computer “when we ask it to do too many things at once.” The project manager, Brian Muirhead, said that to prevent a recurrence, controllers would schedule activities one after another, instead of at the same time. It was the second time the Pathfinder's computer had reset itself while trying to carry out several activities at once. In response, controllers reprogrammed the computer over the weekend to slow down the rate of activities and avoid another reset. But today, about an hour into a two-hour transmission session, it happened again.

  11. Priority-Based Scheduling • Scheduler ensures that the highest priority task that can run is always running • Lower priority tasks run only when no higher priority task can run Standard JavaVM scheduler does not do this, but many operating Systems for embedded systems do including the vxWorks used on the PathFinder. What can go wrong with priority-based scheduling?

  12. Priority Inversion Low High Medium synchronized(r) synchronized(r) Pre-empts low-priority thread Waiting on lock r (held by low-priority task)

  13. Priority Inversion on Mars Meterological data task (low priority) Bus Management Task (high priority) Data collection task (medium priority) For details, see http://research.microsoft.com/~mbj/Mars_Pathfinder/Authoritative_Account.html

  14. Solutions? • Priority Inheritance • If a low priority task holds a resource needed by a high priority task, the low priority task temporarily inherits the high task’s priority • Priority Ceilings • Associate minimum priorities with resources

  15. As suspected, the Pathfinder computer, struggling with several activities at once, reset itself each time it could not carry out low-priority tasks in the allotted time. A reset is a safety feature similar to hitting a reset button on a home computer. The low-priority task that kept tripping it up was the transfer of temperature and wind measurements from sensors to an electronics board and then into the computer. The solution is to raise the task's priority through some reprogramming, Mr. Muirhead said.

  16. Charge Thread work = new Thread (ps5); work.setPriority (Thread.MAX_PRIORITY); work.start ();

More Related