Parallel Programming (Part 2)
|
|
- Cordelia Reed
- 5 years ago
- Views:
Transcription
1 Parallel Programming (Part 2)
2 Dining Philosophers as Scheduling Tasks Scheduling the eating schedule for philosophers can be thought of as scheduling CPU cores to perform tasks. Dining Philosophers Problem: Input: n philosophers arriving to a dinner party and the times that they arrive. Output: A schedule of philosophers eating/thinking so that all eat as much as possible. In order to eat, a philosopher must hold the chopstick on each side.
3 Difficult Problems to Parallelize Think: What kinds of problems would be difficult to parallelize? 1. Compute n-th Fibonacci number F n (depends on computing F n-1 and F n-2 ). 2. Given initial configuration of a Game of Life Board, a cell, and an integer T, is the cell alive after T steps? (Depends on computing the board at T-1 steps, which depends on T-2 steps, etc.)
4 Example of Partial Parallelization Think: How could we parallelize the problem of updating a GoL board after a single iteration?
5 Parallelizing One Game of Life Iteration 1 processor
6 Parallelizing One Game of Life Iteration 2 processors
7 Parallelizing One Game of Life Iteration 4 processors
8 Parallelizing One Game of Life Iteration 16 processors
9 Parallelizing One Game of Life Iteration Think: What is the difficulty of this approach?
10 Parallelizing One Game of Life Iteration Think: What is the difficulty of this approach? Answer: Cores must communicate across the boundaries.
11 Parallelizing One Game of Life Iteration Think: What is the difficulty of this approach? Answer: Cores must communicate across the boundaries. The more cores, the more boundary cells, which can slow us down.
12 Quantifying Limits of Parallel Programming Exercise: If we have 4 cores, and 40% of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm?
13 Quantifying Limits of Parallel Programming Exercise: If we have 4 cores, and 40% of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm? Answer: 0.4/ = 0.7, so it is 30% faster.
14 Quantifying Limits of Parallel Programming Exercise: If we have N cores, and p percent of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm?
15 Quantifying Limits of Parallel Programming Exercise: If we have N cores, and p percent of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm? Answer: It will run in fraction p/n + (1-p) time compared to the serial algorithm. This is called Amdahl s law.
16 Quantifying Limits of Parallel Programming Exercise: If we have 3 million cores, and 99% of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm?
17 Quantifying Limits of Parallel Programming Exercise: If we have 3 million cores, and 99% of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm? Answer: 0.99/(3 million) ~ So the algorithm is only about 100 times faster.
18 Quantifying Limits of Parallel Programming Exercise: If we have 3 million cores, and 99% of our algorithm can be parallelized, how much quicker will a parallel algorithm run than a serial algorithm? Answer: 0.99/(3 million) ~ So the algorithm is only about 100 times faster. General Rule: as N à, p/n + (1-p) à 1-p
19 You ve Learned to Think Serially about Go Think: What is the flow of the following program? func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { f(0)
20 Goroutines Represent Parallelism in Go Goroutine: When go f(0) is called, f(0) is called in the background and the program continues running. func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { go f(0)
21 Goroutines Represent Parallelism in Go Goroutine: When go f(0) is called, f(0) is called in the background and the program continues running. func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { go f(0) Think: What do you think will be printed?
22 Goroutines Represent Parallelism in Go Goroutine: When go f(0) is called, f(0) is called in the background and the program continues running. func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { go f(0) Answer: Nothing! Program exits before it has any time...
23 Goroutines Represent Parallelism in Go We add a Scanln() line so the program doesn t quit early. func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { go f(0) var input string fmt.scanln(&input)
24 Running Multiple Goroutines func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) func main() { for i := 0; i < 10; i++ { go f(i) var input string fmt.scanln(&input) Think: What do you think will be printed?
25 Goroutines Really are Running Concurrently! func f(n int) { for i := 0; i < 10; i++ { fmt.println(n, ":", i) time.sleep(time.millisecond * 100) func main() { for i := 0; i < 10; i++ { go f(i) var input string fmt.scanln(&input) Now we can see that calls to f() are running concurrently.
26 Timing Programs Think: What do you think the speedup is? for i := 0; i < 10; i++ { go f(i) var input string fmt.scanln(&input) for i := 0; i < 10; i++ { f(i) var input string fmt.scanln(&input)
27 Timing Programs Think: What do you think the speedup is? for i := 0; i < 10; i++ { go f(i) var input string fmt.scanln(&input) for i := 0; i < 10; i++ { f(i) var input string fmt.scanln(&input) One way of timing functions is with the following code. start := time.now() // insert code you want to time here... elapsed := time.since(start) log.printf("g took %s", elapsed)
28 Recall: Peculiar Stats of #G - #C Forward half-strand (single-stranded life): shortage of C, normal G Reverse half-strand (double-stranded life): shortage of G, normal C #C #G #G - #C Reverse half-strand Forward half-strand Difference
29 Recall: #G - #C is DECREASING #G - #C is INCREASING ori 5 C high G low You walk along the genome and see that #G - #C has been decreasing and then suddenly starts increasing. Where are you in the genome? C low G high terc C high/g low #G - #C is DECREASING as we walk along the REVERSE half-strand C low/g high #G - #C is INCREASING as we walk along the FORWARD half-strand
30 Defining the Skew Array Skew[k]: #G - #C for the first k nucleotides of Genome. Skew diagram: Plot Skew[k] against k 2 1 skew position C ATGGGC ATC GGCCATAC G CC
31 Skew Array of E. coli Identifies ori ori! You walk along the genome and see that #G - #C have been decreasing and then suddenly starts increasing. Where are you in the genome?
32 Generating Skew Arrays for Many Genomes genomefilenames := []string{"bacillus_anthracis.txt", "chlamydia_muridarum.txt", //etc. skews := make(map[string][]int) for i := range genomefilenames { currentname := genomefilenames[i] currentgenome := go readfasta(currentname) skews[currentname] = go SkewArray(currentGenome)
33 Generating Skew Arrays for Many Genomes genomefilenames := []string{"bacillus_anthracis.txt", "chlamydia_muridarum.txt", //etc. skews := make(map[string][]int) for i := range genomefilenames { currentname := genomefilenames[i] currentgenome := go readfasta(currentname) skews[currentname] = go SkewArray(currentGenome) Error! A goroutine can t return a value (when functions are run concurrently, return values may be overwritten).
34 Channels Allow Goroutines to Communicate func pinger(c chan string) { for i := 0; ; i++ { c <- "ping" func printer(c chan string) { for { msg := <- c fmt.println(msg) time.sleep(time.second) func main() { var c chan string = make(chan string) go pinger(c) go printer(c) var input string fmt.scanln(&input)
35 Adding a Ponger to Illustrate Blocking Blocking: When pinger() tries to send a message, it waits until printer() is ready to receive it. func ponger(c chan string) { for i := 0; ; i++ { c <- "pong" func main() { var c chan string = make(chan string) go pinger(c) go ponger(c) go printer(c) var input string fmt.scanln(&input) Think: What do you think will be printed?
36 Returning to Skew Arrays Next Time: Using channels to generate multiple skew arrays.
func findbestfold(seq string, energyfunction func(fold)float64)) Fold {
Carl Kignsford, 0-0, Fall 0 Loose Ends Functions as values of variables Sometimes it would be useful to pass a function as a parameter to another function. For example, suppose you were writing a protein
More informationVL Bioinformatik für Nebenfächler SS2018 Woche 4
VL Bioinformatik für Nebenfächler SS2018 Woche 4 Tim Conrad AG Medical Bioinformatics Institut für Mathematik & Informatik, FU Berlin Based on slides by P. Compeau and P. Pevzner, authors of Tutorien-Termine
More informationQuiz for Chapter 1 Computer Abstractions and Technology
Date: Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in Red 1. [15 points] Consider two different implementations,
More informationQuiz for Chapter 1 Computer Abstractions and Technology 3.10
Date: 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: 1. [15 points] Consider two different implementations, M1 and
More informationCS Programming Languages: Scala
CS 3101-2 - Programming Languages: Scala Lecture 6: Actors and Concurrency Daniel Bauer (bauer@cs.columbia.edu) December 3, 2014 Daniel Bauer CS3101-2 Scala - 06 - Actors and Concurrency 1/19 1 Actors
More informationQUIZ Ch.6. The EAT for a two-level memory is given by:
QUIZ Ch.6 The EAT for a two-level memory is given by: EAT = H Access C + (1-H) Access MM. Derive a similar formula for three-level memory: L1, L2 and RAM. Hint: Instead of H, we now have H 1 and H 2. Source:
More informationGoals: Define computational problem instance of a computational problem algorithm pseudocode Briefly discuss recursive procedure big-o notation
Goals: Define computational problem instance of a computational problem algorithm pseudocode Briefly discuss recursive procedure big-o notation algorithms 1 p.1/19 Informal Definitions: A computational
More informationConcept of a process
Concept of a process In the context of this course a process is a program whose execution is in progress States of a process: running, ready, blocked Submit Ready Running Completion Blocked Concurrent
More informationGO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR
GO SHORT INTERVIEW QUESTIONS EXPLAINED IN COLOR REVISION 1 HAWTHORNE-PRESS.COM Go Short Interview Questions Explained in Color Published by Hawthorne-Press.com 916 Adele Street Houston, Texas 77009, USA
More informationLecture 3: Intro to Concurrent Processing using Semaphores
Lecture 3: Intro to Concurrent Processing using Semaphores Semaphores; The Prucer-Consumer problem; The Dining Philosophers problem; The Readers-Writers Problem: Readers Preference Passing the Baton Ballhausen
More informationConsider the above code. This code compiles and runs, but has an error. Can you tell what the error is?
Discussion 1H Notes (Week 8, May 20) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 Dynamic Allocation of Memory Recall that when you create an array, you must know
More informationConcurrency in Go 9/22/17
Concurrency in Go 9/22/17 Outline Mapreduce (15 mins) Two synchronization mechanisms Locks (15 mins) Channels (20 mins) Application: Word count Hello my love. I love you, my dear. Goodbye. hello: 1, my:
More informationThreading the Code. Self-Review Questions. Self-review 11.1 What is a thread and what is a process? What is the difference between the two?
Threading the Code 11 Self-Review Questions Self-review 11.1 What is a thread and what is a process? What is the difference between the two? Self-review 11.2 What does the scheduler in an operating system
More informationConditionals !
Conditionals 02-201! Computing GCD GCD Problem: Compute the greatest common divisor of two integers. Input: Two integers a and b. Output: The greatest common divisor of a and b. Exercise: Design an algorithm
More informationGO CONCURRENCY BASICS AND PATTERNS EXPLAINED IN COLOR
GO CONCURRENCY BASICS AND PATTERNS EXPLAINED IN COLOR REVISION 1 HAWTHORNE-PRESS.COM Go Concurrency Basics Explained In Color Published by Hawthorne-Press.com 916 Adele Street Houston, Texas 77009, USA
More informationChapter 6: Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Synchronization, Silberschatz, Galvin and Gagne 2009 Outline Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization
More informationGo Concurrent Programming. QCon2018 Beijing
Go Concurrent Programming chao.cai@mobvista.com QCon2018 Beijing Shared Memory Model Shared Memory Model class Worker implements Runnable{ private volatile boolean isrunning = false; @Override public void
More informationDeadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1
Deadlock Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Recap: Synchronization Race condition A situation when two or more threads read and write shared
More informationCS 103 Unit 11. Linked Lists. Mark Redekopp
1 CS 103 Unit 11 Linked Lists Mark Redekopp 2 NULL Pointer Just like there was a null character in ASCII = '\0' whose ue was 0 There is a NULL pointer whose ue is 0 NULL is "keyword" you can use in C/C++
More informationThe Go Programming Language. Frank Roberts
The Go Programming Language Frank Roberts frank.roberts@uky.edu - C++ (1983), Java (1995), Python (1991): not modern - Java is 18 years old; how has computing changed in 10? - multi/many core - web programming
More informationEI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)
EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) Dept. of Computer Science & Engineering Chentao Wu wuct@cs.sjtu.edu.cn Download lectures ftp://public.sjtu.edu.cn User:
More informationLecture Topics. Announcements. Today: Concurrency (Stallings, chapter , 5.7) Next: Exam #1. Self-Study Exercise #5. Project #3 (due 9/28)
Lecture Topics Today: Concurrency (Stallings, chapter 5.1-5.4, 5.7) Next: Exam #1 1 Announcements Self-Study Exercise #5 Project #3 (due 9/28) Project #4 (due 10/12) 2 Exam #1 Tuesday, 10/3 during lecture
More informationClass Notes, 3/21/07, Operating Systems
Class Notes, 3/21/07, Operating Systems Hi, Jane. Thanks again for covering the class. One of the main techniques the students need to how to recognize when there is a cycle in a directed graph. (Not all
More informationParallel Processing: Performance Limits & Synchronization
Parallel Processing: Performance Limits & Synchronization Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. May 8, 2018 L22-1 Administrivia Quiz 3: Thursday 7:30-9:30pm, room 50-340
More informationUniversity of California, Berkeley College of Engineering
University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Spring 2012 Instructor: Dan Garcia 2012-03-22 Last Name First Name Student ID Number
More informationArrays/Slices Store Lists of Variables
Maps 02-201 Arrays/Slices Store Lists of Variables H i T h e r e! 0 1 2 3 4 5 6 7 8 1 1 2 3 5 8 13 21 34 55 89 0 1 2 3 4 5 6 7 8 9 10 ACG TTA GAG CCT TAA GGG CAT 0 1 2 3 4 5 6 What if Indices Aren t Integers?
More informationChapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6.
Part Three - Process Coordination Chapter 6: Synchronization 6.1 Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure
More information1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line
1.2 Adding Integers Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line Finding Sums Mentally The Commutative Property Finding Sums using And Patterns and Rules of Adding Signed
More informationCS 103 Unit 11. Linked Lists. Mark Redekopp
1 CS 103 Unit 11 Linked Lists Mark Redekopp 2 NULL Pointer Just like there was a null character in ASCII = '\0' whose ue was 0 There is a NULL pointer whose ue is 0 NULL is "keyword" you can use in C/C++
More informationA Slice of Life
A Slice of Life 02-201 More on Slices Last Time: append() and copy() Operations s := make([]int, 10)! s = append(s, 5)! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 5! 0! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! s! c := make([]int,
More informationWhat Came First? The Ordering of Events in
What Came First? The Ordering of Events in Systems @kavya719 kavya the design of concurrent systems Slack architecture on AWS systems with multiple independent actors. threads in a multithreaded program.
More informationAnnouncement. Computer Architecture (CSC-3501) Lecture 23 (17 April 2008) Chapter 7 Objectives. 7.1 Introduction. 7.2 I/O and Performance
Computer Architecture (CSC-3501) Lecture 23 (17 April 2008) Announcement Homework #8 and #9 are uploaded at class website Seung-Jong Park (Jay) http://www.csc.lsu.edu/~sjpark 1 2 Chapter 7 Objectives 7.1
More informationLast Class: Synchronization Problems!
Last Class: Synchronization Problems! Reader Writer Multiple readers, single writer In practice, use read-write locks Dining Philosophers Need to hold multiple resources to perform task Lecture 11, page
More informationi219 Software Design Methodology 12. Case study 1 Dining philosopher problem Kazuhiro Ogata (JAIST) Outline of lecture
i219 Software Design Methodology 12. Case study 1 Dining philosopher problem Kazuhiro Ogata (JIST) Outline of lecture 2 Dining philosopher problem (DPP) Dining Room in UML & Java Chopstick in UML & Java
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST II Date: 04/04/2018 Max Marks: 40 Subject & Code: Operating Systems 15CS64 Semester: VI (A & B) Name of the faculty: Mrs.Sharmila Banu.A Time: 8.30 am 10.00 am Answer any FIVE
More informationResource Allocation. Pradipta De
Resource Allocation Pradipta De pradipta.de@sunykorea.ac.kr Outline Dining Philosophers Problem Drinking Philosophers Problem Dining Philosophers Problem f(5) 5 f(1) Each philosopher goes through, Think
More informationConcurrent & Distributed Systems Supervision Exercises
Concurrent & Distributed Systems Supervision Exercises Stephen Kell Stephen.Kell@cl.cam.ac.uk November 9, 2009 These exercises are intended to cover all the main points of understanding in the lecture
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Chapter 6: Synchronization 6.1 Background 6.2 The Critical-Section Problem 6.3 Peterson s Solution 6.4 Synchronization Hardware 6.5 Mutex Locks 6.6 Semaphores 6.7 Classic
More informationAlgorithms... 1 Changing state... 1 Calculations... 3 Processing information... 4 Calling methods... 6 The Call Stack... 7 Wrap up...
7. ALGORITHMS AND METHOD CALLS Algorithms... 1 Changing state... 1 Calculations... 3 Processing information... 4 Calling methods... 6 The Call Stack... 7 Wrap up... 9 Algorithms You now know quite a lot
More informationDining Philosophers, Semaphores
CS 220: Introduction to Parallel Computing Dining Philosophers, Semaphores Lecture 27 Today s Schedule Dining Philosophers Semaphores Barriers Thread Safety 4/30/18 CS 220: Parallel Computing 2 Today s
More informationInstruction-Level Parallelism Dynamic Branch Prediction. Reducing Branch Penalties
Instruction-Level Parallelism Dynamic Branch Prediction CS448 1 Reducing Branch Penalties Last chapter static schemes Move branch calculation earlier in pipeline Static branch prediction Always taken,
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS
More informationChapter 6 Project: A New Model for Earthquakes
Chapter 6 Project: A New Model for Earthquakes Name Name 1. Background: Faults are approximately planar breaks in the Earth's crust and mantle. Crustal blocks moving quickly along a fault produce vibrations
More informationSynchronization Principles II
CSC 256/456: Operating Systems Synchronization Principles II John Criswell University of Rochester 1 Synchronization Issues Race conditions and the need for synchronization Critical Section Problem Mutual
More informationECE 3055: Final Exam
ECE 3055: Final Exam Instructions: You have 2 hours and 50 minutes to complete this quiz. The quiz is closed book and closed notes, except for one 8.5 x 11 sheet. No calculators are allowed. Multiple Choice
More informationobservability and product release: leveraging prometheus to build and test new products digitalocean.com
@snehainguva observability and product release: leveraging prometheus to build and test new products about me software engineer @DigitalOcean currently network services
More informationSynchronization Principles
Synchronization Principles Gordon College Stephen Brinton The Problem with Concurrency Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms
More information7 Control Structures, Logical Statements
7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,
More informationOperating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy
Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference
More informationRecursion. COMS W1007 Introduction to Computer Science. Christopher Conway 26 June 2003
Recursion COMS W1007 Introduction to Computer Science Christopher Conway 26 June 2003 The Fibonacci Sequence The Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, 21, 34,... We can calculate the nth Fibonacci
More informationTwo Dimensional Arrays
+ Two Dimensional Arrays + Two Dimensional Arrays So far we have studied how to store linear collections of data using a single dimensional array. However, the data associated with certain systems (a digital
More informationGo for Java Developers
Go for Java Developers Stoyan Rachev May 26-27 16, Sofia 1 Agenda Introduction Variables and Control Flow Types and Data Structures Functions Methods and Interfaces Concurrency Conclusion 2 What is Go?
More informationCSC 110 Lab 9 Operating Systems Algorithms. Names: What might be an advantage of this algorithm? What might be a disadvantage of this algorithm?
CSC 110 Lab 9 Operating Systems Algorithms Names: Introduction The purpose of this lab is to understand some basic operating systems algorithms and practice implementing parts of these algorithms in Python.
More information5.6 Rational Equations
5.6 Rational Equations Now that we have a good handle on all of the various operations on rational expressions, we want to turn our attention to solving equations that contain rational expressions. The
More informationDefining Performance. Performance. Which airplane has the best performance? Boeing 777. Boeing 777. Boeing 747. Boeing 747
Defining Which airplane has the best performance? 1 Boeing 777 Boeing 777 Boeing 747 BAC/Sud Concorde Douglas DC-8-50 Boeing 747 BAC/Sud Concorde Douglas DC- 8-50 0 100 200 300 400 500 Passenger Capacity
More informationMore About WHILE Loops
More About WHILE Loops http://people.sc.fsu.edu/ jburkardt/isc/week04 lecture 07.pdf... ISC3313: Introduction to Scientific Computing with C++ Summer Semester 2011... John Burkardt Department of Scientific
More informationCMPT 300: Operating Systems I Assignment 1
POLICIES: CMPT 300: Operating Systems I Assignment 1 Sample Solution 1. Coverage Chapters 1-6 2. Grade 10 points, 100% counted into the final grade 3. Individual or Group Individual based, but group discussion
More informationCS430 Computer Architecture
CS430 Computer Architecture Spring 2015 Spring 2015 CS430 - Computer Architecture 1 Chapter 14 Processor Structure and Function Instruction Cycle from Chapter 3 Spring 2015 CS430 - Computer Architecture
More informationAlgorithm Design and Recursion. Search and Sort Algorithms
Algorithm Design and Recursion Search and Sort Algorithms Objectives To understand the basic techniques for analyzing the efficiency of algorithms. To know what searching is and understand the algorithms
More informationCISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)
CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) For this lab you may work with a partner, or you may choose to work alone. If you choose to work with a partner, you are still responsible for the lab
More informationCS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019
CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?
More informationThreads and Locks, Part 2. CSCI 5828: Foundations of Software Engineering Lecture 08 09/18/2014
Threads and Locks, Part 2 CSCI 5828: Foundations of Software Engineering Lecture 08 09/18/2014 1 Goals Cover the material presented in Chapter 2 of our concurrency textbook In particular, selected material
More informationMPI introduction - exercises -
MPI introduction - exercises - Introduction to Parallel Computing with MPI and OpenMP P. Ramieri May 2015 Hello world! (Fortran) As an ice breaking activity try to compile and run the Helloprogram, either
More informationThe dining philosophers problem. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 13
CS 361 Concurrent programming Drexel University Fall 2004 Lecture 13 Bruce Cha and Vera Zaychikr. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce
More informationAlgorithms. MIS, KUAS, 2007 Ding
Algorithms MIS, KUAS, 2007 Jen-Wen Ding 1 2 2 What is Divide-and-Conquer? Divide-and-Conquer divides an instance of a problem into two or more smaller instances. The smaller instances are usually instances
More informationCe qui est important dans l'enseignement des mathématiques. Marian Small novembre 2017
Ce qui est important dans l'enseignement des mathématiques Marian Small novembre 2017 Playing with math Uae your linking cubes. Show that the mean of 4, 7 and 7 is 6. Playing with math Uae your linking
More informationChapter 7: Process Synchronization!
Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Monitors 7.1 Background Concurrent access to shared
More informationProcess Management And Synchronization
Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the
More informationComputer Systems and Networks
LECTURE 7: PERFORMANCE MEASUREMENT Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) University of the Pacific Lab Schedule Today Lab 5 Performance Measurement is open Work
More informationHOW TO WRITE PARALLEL PROGRAMS AND UTILIZE CLUSTERS EFFICIENTLY
HOW TO WRITE PARALLEL PROGRAMS AND UTILIZE CLUSTERS EFFICIENTLY Sarvani Chadalapaka HPC Administrator University of California Merced, Office of Information Technology schadalapaka@ucmerced.edu it.ucmerced.edu
More informationOperating Systems: (Tue)
Operating Systems: (Tue) Definition: An operating system is the set of software that controls the overall operation of a computer system. provides an interface between the application software and the
More informationConcurrent Systems Modeling using Petri Nets Part II
Concurrent Systems Modeling using Petri Nets Part II Marlon Dumas (Based on lecture material by Wil van der Aalst Eindhoven University of Technology, The Netherlands http://www.workflowcourse.com) PN-1
More informationCS61B, Spring 2003 Discussion #15 Amir Kamil UC Berkeley 4/28/03
CS61B, Spring 2003 Discussion #15 Amir Kamil UC Berkeley 4/28/03 Topics: Sorting 1 Sorting The topic of sorting really requires no introduction. We start with an unsorted sequence, and want a sorted sequence
More information/ / / Net Speedup. Percentage of Vectorization
Question (Amdahl Law): In this exercise, we are considering enhancing a machine by adding vector hardware to it. When a computation is run in vector mode on the vector hardware, it is 2 times faster than
More informationDefining Performance. Performance 1. Which airplane has the best performance? Computer Organization II Ribbens & McQuain.
Defining Performance Performance 1 Which airplane has the best performance? Boeing 777 Boeing 777 Boeing 747 BAC/Sud Concorde Douglas DC-8-50 Boeing 747 BAC/Sud Concorde Douglas DC- 8-50 0 100 200 300
More information2.1 Basics of Functions and Their Graphs
.1 Basics of Functions and Their Graphs Section.1 Notes Page 1 Domain: (input) all the x-values that make the equation defined Defined: There is no division by zero or square roots of negative numbers
More informationFigure 1 Logical view of the system memory.
Memory Addressing The memory of a computer system consists of tiny electronic switches, with each switch in one of two states: open or closed. It is, however, more convenient to think of these states as
More informationMore on Strings & Arrays
More on Strings & Arrays 02-201 Indexing Strings Strings work like arrays in some ways: Strings have fixed length. You can find the length of string s with len(s). You can access elements of string s with
More informationPage 1. Program Performance Metrics. Program Performance Metrics. Amdahl s Law. 1 seq seq 1
Program Performance Metrics The parallel run time (Tpar) is the time from the moment when computation starts to the moment when the last processor finished his execution The speedup (S) is defined as the
More informationProcess Synchronization
Process Synchronization Concurrent access to shared data in the data section of a multi-thread process, in the shared memory of multiple processes, or in a shared file Although every example in this chapter
More informationAsynchronous Method Calls White Paper VERSION Copyright 2014 Jade Software Corporation Limited. All rights reserved.
VERSION 7.0.10 Copyright 2014 Jade Software Corporation Limited. All rights reserved. Jade Software Corporation Limited cannot accept any financial or other responsibilities that may be the result of your
More informationDeadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018
Deadlock and Monitors CS439: Principles of Computer Systems September 24, 2018 Bringing It All Together Processes Abstraction for protection Define address space Threads Share (and communicate) through
More informationRecitation 1. Scan. 1.1 Announcements. SkylineLab has been released, and is due Friday afternoon. It s worth 125 points.
Recitation 1 Scan 1.1 Announcements SkylineLab has been released, and is due Friday afternoon. It s worth 125 points. BignumLab will be released on Friday. 1 2 RECITATION 1. SCAN 1.2 What is scan? In the
More informationConcurrent Systems Modeling using Petri Nets Part II
Concurrent Systems Modeling using Petri Nets Part II Marlon Dumas (Based on lecture material by Wil van der Aalst Eindhoven University of Technology, The Netherlands http://www.workflowcourse.com) PN-1
More informationVector and Parallel Processors. Amdahl's Law
Vector and Parallel Processors. Vector processors are processors which have special hardware for performing operations on vectors: generally, this takes the form of a deep pipeline specialized for this
More information3 Perceptron Learning; Maximum Margin Classifiers
Perceptron Learning; Maximum Margin lassifiers Perceptron Learning; Maximum Margin lassifiers Perceptron Algorithm (cont d) Recall: linear decision fn f (x) = w x (for simplicity, no ) decision boundary
More informationMath 4242 Fibonacci, Memoization lecture 13
Math 4242 Fibonacci, Memoization lecture 13 Today we talk about a problem that sometimes occurs when using recursion, and a common way to fix it. Recall the Fibonacci sequence (F 1, F 2,...) that occurs
More informationCUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012
CUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012 Overview 1. Memory Access Efficiency 2. CUDA Memory Types 3. Reducing Global Memory Traffic 4. Example: Matrix-Matrix
More informationLecture Notes on Memory Layout
Lecture Notes on Memory Layout 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 11 1 Introduction In order to understand how programs work, we can consider the functions,
More informationSynchronization Basic Problem:
Synchronization Synchronization Basic Problem: If two concurrent processes are accessing a shared variable, and that variable is read, modified, and written by those processes, then the variable must be
More informationLesson 12: The Graph of the Equation y = f(x)
Classwork In Module 1, you graphed equations such as 4x + y = 10 by plotting the points on the Cartesian coordinate plane that corresponded to all of the ordered pairs of numbers (x, y) that were in the
More informationThe Art and Science of Memory Allocation
Logical Diagram The Art and Science of Memory Allocation Don Porter CSE 506 Binary Formats RCU Memory Management Memory Allocators CPU Scheduler User System Calls Kernel Today s Lecture File System Networking
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 15
CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 15 Dr. Kinga Lipskoch Fall 2017 How to Compute a Binary Float Decimal fraction: 8.703125 Integral part: 8 1000 Fraction part: 0.703125
More informationWilliam Kennedy. Brian Ketelsen Erik St. Martin Steve Francia FOREWORD BY MANNING WITH
SAMPLE CHAPTER William Kennedy WITH FOREWORD BY Brian Ketelsen Erik St. Martin Steve Francia MANNING Go in Action by William Kennedy with Brian Ketelsen and Erik St. Martin Chapter 2 Copyright 2015 Manning
More informationThinking parallel. Decomposition. Thinking parallel. COMP528 Ways of exploiting parallelism, or thinking parallel
COMP528 Ways of exploiting parallelism, or thinking parallel www.csc.liv.ac.uk/~alexei/comp528 Alexei Lisitsa Dept of computer science University of Liverpool a.lisitsa@.liverpool.ac.uk Thinking parallel
More informationCSE Traditional Operating Systems deal with typical system software designed to be:
CSE 6431 Traditional Operating Systems deal with typical system software designed to be: general purpose running on single processor machines Advanced Operating Systems are designed for either a special
More informationHomework. Reading: Chapter 17 Homework: All exercises from Chapter 17 Due: 10/27 Correction: Chapter 16 homework is due 10/25
Homework Reading: Chapter 17 Homework: All exercises from Chapter 17 Due: 10/27 Correction: Chapter 16 homework is due 10/25 Copyright c 2002 2017 UMaine Computer Science Department 1 / 33 1 COS 140: Foundations
More informationENCM 501 Winter 2016 Assignment 1 for the Week of January 25
page 1 of 5 ENCM 501 Winter 2016 Assignment 1 for the Week of January 25 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2016 Assignment instructions and other
More informationSoftware Analysis. Asymptotic Performance Analysis
Software Analysis Performance Analysis Presenter: Jonathan Aldrich Performance Analysis Software Analysis 1 Asymptotic Performance Analysis How do we compare algorithm performance? Abstract away low-level
More informationGo Tutorial. To do. A brief, gentle intro to Go. Next Networking. q Today
Go Tutorial To do q Today A brief, gentle intro to Go q Next Networking About Go Developed by Google Webpage: https://golang.org/ Concurrency was a priority in the language design A bit of a mix between
More information