1 / 27

Limited Time and Experience: Parallelism in CS1

Limited Time and Experience: Parallelism in CS1. Fourth NSF/TCPP Workshop on Parallel and Distributed Computing Education (EduPar-14). Steven Bogaerts. Outline. Context Details of topic coverage Evaluation. Parallelism in CS1. Benefit

Download Presentation

Limited Time and Experience: Parallelism in CS1

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. Limited Time and Experience: Parallelism in CS1 Fourth NSF/TCPP Workshop on Parallel and Distributed Computing Education (EduPar-14) Steven Bogaerts

  2. Outline • Context • Details of topic coverage • Evaluation

  3. Parallelism in CS1 • Benefit • See parallelism as a natural and common part of programming • Challenge • Unique cognitive and technical issues

  4. CS1 at DePauw • Audience: Intended majors, minors, related disciplines, math-phobic • Two sections, same parallelism outline, based on same pre/post test • Background, Moore’s Law, speedup expected, race conditions, locks, communication and coordination • Around week 12 out of 14

  5. Two Sections: Differences • Section B: • 26 students • ~1.5 hours on parallelism • Primarily lecture, some brief exercises • Section A: • 28 students • ~4 hours on parallelism • Lecture, exercises, activities, analogies, brief Java implementation

  6. Overview of Analogies and Exercises • Parallelism in real life • Clock speed • Interprocess Communication • Race Conditions • Locks • Join • Java Implementation

  7. Parallelism in Real Life • If I can shovel my driveway in 1 hour, how long would you expect it to take if someone equally capable were helping me? • Answer: 30 minutes • Split up the task:easy • Communication required:very little

  8. Parallelism in Real Life • If one person can dig a hole with a shovel in 100 seconds, how long would it take for 10 people to dig that hole? • Answer:80 seconds? • Split up the task:hard • Communication required:some

  9. Parallelism in Real Life • If I can run a company all by myself by working 100 hours per week, how much time do I need if I hire an assistant? • Answer:75 hours? • Split up the task:hard • Communication required:a lot

  10. Parallelism in Real Life • Lessons: • Task must be split up • Communication required for coordination • Can be much overhead • Can explore more “real life” examples • Briefly introduce parallel computation examples

  11. Clock Speed • Measuring the speed of a processor • Why not just make the clock tick faster? • Analogy: Make a peanut butter and jelly sandwich at the rate of: • 1 per hour • 1 per minute…? • 1 per second…??!? • One technology improvement: smaller transistors (Moore’s Law) • Leading into increased prevalence of parallelism today

  12. Interprocess Communication • Analogy: friend and I count how many people are in a building • Communication options: • ”I’ve counted 27 people in the basement. Please go count the other floors and determine the total.”(Passing data at process creation) • ”I’ll count the basement, you count the other floors. Whenever you finish a floor, send me a text message with that result. I’ll merge your results with mine.”(Message-passing) • ”I’ll count the basement, you count the other floors. Whenever you finish a floor, open up our shared Google Doc. Add what you just counted to the total already in the doc, and erase the old total. I’ll do the same as I go.”(Shared memory)

  13. Interprocess Communication • Card sorting activity • Group A (sequentialism): • 1 person (processing element) • 1 sheet of workspace (RAM) • Group B (message passing parallelism): • 2 people (processing elements) • Each with 1 sheet of workspace (RAM) • Communicate only via message passed by a 3rd person • Group C (shared memory parallelism): • 2 people (processing elements) • 1 sheet of workspace (RAM)

  14. InterprocessCommunication: Observations • Much variation in which group finishes first. • Sequentialism • No parallelism overhead, but work alone • Message passing • Communication was a little slower • Shared memory • Faster communication, but can more easily “mess up” each other’s work

  15. Race Conditions • x++ modeled as: • Get the value of x • Compute x+1 • Store the result in x • Processes A and B, two of many possibilities:

  16. Locks • Analogy: conch shell in Lord of the Flies

  17. Join • Confusion: which process is waiting? • Analogy • Parent walking with a child • Child goes to pick flowers • Parent can go on a bit, but eventually must wait for child to join.

  18. Java Implementation • Hides a few Java-specific details • Runnable vs. Thread • Exceptions • Implement an interface (run)

  19. Evaluation • Comparing two sections: • Section A: 4 hours, many analogies and exercises • Section B: 1.5 hours, mostly lecture • Four opinion questions • Self-rated interest and ability in parallelism • Strongly Disagree to Strongly Agree • Eight factual questions • Background, Moore’s Law, speedup expected, race conditions, locks, communication and coordination • Pre-test • Beginning of semester, no course material covered yet • Post-test • Last week of the semester

  20. Pre-test: comparable neutrality • Post-test: A shows stronger increase

  21. Pre-test: comparable disagreement • Post-test: A shows stronger increase

  22. Pre-test: comparable agreement • Post-test: A holding steady B drop

  23. Pre-test: low performance all-around • Post-test: A performance higher • Exception: question 2, a more difficult concurrency question that neither section had really covered

  24. Summary and Conclusions • Student learning • Both sections show evidence • Section A results stronger • Student opinions • Section A students are more positive about the experience • Note: Overall course evaluations and grades were similar between the two sections • It seems that, for better learning and more positive opinions: • The approach of A, while more time-intensive, is helpful to enable students to learn these concepts more effectively as introductory students. • If sufficient time is not available to cover deeply a given set of concepts, it may be preferable to reduce the size of the set, rather than cover the entire set at a more shallow level.

More Related