Critical regions - cl.cam.ac.uk

Critical regions - cl.cam.ac.uk

Concurrency a cautionary tale
Grand Central Dispatch (GCD) by Apple
API for lightweight threads
Work queues hold functions (or code blocks) to be called
Queues can manage concurrency, coordinate joining of tasks
GCD manages scheduling and processor assignment
A simple practical example:
Generating image thumbnails, for all files in a directory, on a quad-core machine.
http://www.mikeash.com/pyblog/friday-qa-2009-09-25-gcd-practicum.html
v1: Sequential program 984 seconds
v2: Nave parallelisation did not run
GCD spawns another thread each time one blocks
Each task (a) hits the disk, (b) allocates memory to decompress images
Then the OS starts swapping, i.e. more disk contention
and GCD spawns another thread
v3: Read files sequentially in a single task, compress in parallel 300 seconds
This is self-limiting, but can still thrash
(Used only 10GB RAM on a machine with 15GB!)
v4: Limit the number of tasks to 2 x number of CPU cores 279 seconds
The CPU is not the only resource that threads / processes must share.
Concurrency (and distribution) libraries provide programmer support, not solutions.
Cross address-space IPC

16

Recently Viewed Presentations

  • Diapositiva 1 - Teaching PNIEB... ideas and cool things

    Diapositiva 1 - Teaching PNIEB... ideas and cool things

    nine. nine. two. six. 26. fourteen. five. seven. eight. 27. fifteen. three. eight. four. 28. sixteen. four. thirteen. five. 29. five. eight. ten. one. 30. ten. nine ...
  • Economic Effects of Enacting the Raise the Wage

    Economic Effects of Enacting the Raise the Wage

    Economic Effects of Enacting the Raise the Wage Act on Small Businesses and the U.S. Economy. Michael J. Chow. Auber Annual Fall Conference. October 14th, 2019
  • 4th Edition: Chapter 1

    4th Edition: Chapter 1

    How would you define it ? What Is Research? Merriam-Webster's definition 1 : Careful or diligent search 2 : Studious inquiry or examination; especially : Investigation or experimentation aimed at the discovery and interpretation of facts, revision of accepted theories...
  • Came To My Rescue

    Came To My Rescue

    Words and music by: Joseph Scriven and Robert Lowry; Arrangement by: The Sing Team; SASB #645 What a friend we have in Jesus, All our sins and griefs to bear What a privilege to carry Everything to God in prayer!...
  • New Ways of Thinking in the Industrial Revolution

    New Ways of Thinking in the Industrial Revolution

    Jeremy Bentham and Utilitarianism. Goal of society should be "greatest happiness for greatest number" of citizens. Laws should be only if they are USEFUL. Influenced John Stuart Mill, who wanted laws to protect workers
  • Ofsted in the South West Bradley Simmons HMI

    Ofsted in the South West Bradley Simmons HMI

    RAISE Online data is not fully available to the public. It is available to education professionals through the (password protected) RAISE Online service. Poole and Isle of Scilly have been excluded from the data set due to small cohort numbers...
  • Osteoporosis: Targeting Pathways that Lead to Osteoporosis and

    Osteoporosis: Targeting Pathways that Lead to Osteoporosis and

    Paul D. Miller, MD Distinguished Clinical Professor of Medicine University of Colorado Medical Center Colorado Center for Bone Research Lakewood, CO Strategies for Reducing Fracture Risk Antiresorptive Agents Estrogen Calcitonin Bisphosphonates SERMs (selective estrogen receptor modulators) Anti-RANK ligand antibody (in...
  • Unit 5

    Unit 5

    B1.2.1 The nervous system. ... Draw a pyramid of biomass and a pyramid of numbers for oak tree, aphids, ladybirds, label the producer, primary and secondary consumer . Why does it get smaller as it gets to the top? ......