DOC PREVIEW
CU-Boulder CSCI 5828 - Introduction to Concurrency

This preview shows page 1-2-3-22-23-24-44-45-46 out of 46 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 46 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

© University of Colorado, 2010Introduction to ConcurrencyKenneth M. AndersonUniversity of Colorado, BoulderCSCI 5828 — Lecture 4 — 01/21/20101Credit where Credit is DueSome text and images for this lecture come from the lecture materials provided by the publisher of the Magee/Kramer optional textbook. As such, some material is copyright © 2006 John Wiley & Sons, Ltd.2Lecture GoalsReview material in Chapter 1 of the Breshears textbookWho wants to go faster? Raise your hand if you want to go faster! :-)Threading MethodologiesParallel Algorithms (Intro)Cover remainder of Chapter 1 material in Lecture 63Why worry?“Concurrency is hard and I’ve only ever needed single-threaded programs: Why should I care about it?”Answer: multi-core computers, increasing use of clustersGrowth rates for chip speed are flattening“lets wait a year and our system will run faster!”: No longer!Instead, chips are becoming “wider”more cores, wider bus (more data at a time), more memoryAs chips are not getting faster (the same way they used to), a single-threaded, single process application is not going to see any significant performance gains from new hardware4New ModelInstead, software will only see performance gains with new hardware if they are designed to get faster the more processors they have availableThis is not easy: the computations that an application performs have to be amenable to parallelizationSuch an application will see noticeable speed improvements when run on machines with more processors2-cores, 4-cores, 8 cores becoming standard (Intel 80-cores!) A system written for n-cores could potentially see an 80x speed-up when run on such a machine (very hard to achieve linear speed ups, however!)5In addition…Concurrent programming is becoming hard to ignoreIn addition to the increasing presence of multi-core computers there are lots of other domains in which concurrency is the normEmbedded software systems, robotics, “command-and-control”, high-performance computing (use of clusters), …Web programming often requires concurrency (AJAX)Web browsers: examples of multi-threaded GUI applicationswithout threads the UI would block as information is downloaded6BUT…While concurrency is widespread it is also error proneProgrammers trained on single-threaded programs face unfamiliar problems: synchronization, race conditions, deadlocks, etc.Example: Therac-25Concurrent programming errors contributed to accidents causing death and serious injuryMars RoverProblems with interaction between concurrent tasks caused periodic software resets reducing availability for exploration78Basics: Single Thread, Single Process, Single MachineMachineProcessThreadData/CodeSequential Program == Single Thread of Control9Basics: Multiple Thread, Single Process, Single MachineMachineProcessThreadData/CodeThreadConcurrent Program == Multiple Threads of ControlIf the machine has multiple processors, then true parallelism can occur. Otherwise, parallelism is simulated10Multi-Thread: But is it truly parallel?MachineProcessThreadData/CodeThreadConcurrent Program == Multiple Threads of ControlWe may have multiple threads in this process, but we may not have events truly occurring in parallel. Why not?It depends on the machine!Machine11Basics: Single Thread, Multiple Process, Single MachineProcessThreadData/CodeProcessThreadData/CodeProcessThreadData/Code12Basics: Multi-thread, Multi-Process, Single MachineMachineProcessThreadData/CodeThreadProcessThreadData/CodeThreadProcessThreadData/CodeThreadNote: You can have way more than just two threads per process.13Basics: Multi-everythingMachineProcessThreadData/CodeThreadProcessThreadData/CodeThreadProcessThreadData/CodeThreadMachineProcessThreadData/CodeThreadProcessThreadData/CodeThreadProcessThreadData/CodeThreadApplications are Dead! Long Live Applications!14Due to the ability to have multiple threads, multiple processes, and multiple machines work together on a single problem, the notion of an application is changing. It used to be that:ProcessThreadData/CodeApplication ==MachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeNow… we might refer to this as “an application”15Machine6Basics: Multiple Thread, Single Process, Single MachineProcessThreadData/CodeThreadFor instance, we might call this “Google”MachineProcessData/CodeProcessData/CodeProcessData/CodeMachineProcessData/CodeProcessData/CodeProcessData/CodeMachine6Basics: Multiple Thread, Single Process, Single MachineProcessThreadData/CodeThreadmulti-threaded client,multi-threaded serverthat, in turn, relies on a cluster of machines to service the requestArchitecture Design Choices16When designing a modern application, we now have to askHow many machines are involved?What components will be deployed on each machine?For each component:Does it need concurrency?If so, will we achieve concurrency viamultiple threads?multiple processes?both?Consider Chrome (I)Google made a splash last year by announcing the creation of a new web browser that ismulti-process (one process per tab) andmulti-threaded (multiple threads handle loading of content within each process)In typical Google style, they documented their engineering choices via a comic book<http://www.google.com/googlebooks/chrome/index.html>17Consider Chrome (II)Some of the advantages they cite for this designstabilitysingle-process, multi-threaded browsers are vulnerable to having a crash in one tab bring down the entire browserspeedmulti-process browsers can be more responsive due to OS supportsecurityexploits in single-process browsers are easier if malware loaded in one tab can grab information contained in another tab; much harder to grab information across processes18Chrome DemoWe can use process monitoring capabilities to verify that Chrome is indeed multi-process and multi-threaded.Demo19Other benefits to multi-process design*Lots of existing applications that do useful thingsThink of all the powerful command line utilities found in Unix-based platforms; You can take advantage of that power in your own applicationCreate a sub-process, execute the desired tool


View Full Document

CU-Boulder CSCI 5828 - Introduction to Concurrency

Documents in this Course
Drupal

Drupal

31 pages

Deadlock

Deadlock

23 pages

Deadlock

Deadlock

23 pages

Deadlock

Deadlock

22 pages

Load more
Download Introduction to Concurrency
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to Concurrency and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Concurrency 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?