Download presentation
Presentation is loading. Please wait.
Published byFrank Nicholson Modified over 9 years ago
1
Dhananjai M. Rao (raodm@miamioh.edu)raodm@miamioh.edu CSE Department, Oxford, OHIO Using C++11 to teach Concurrency and Parallelism Concepts
2
Students consistently report steep, multifaceted learning curve and challenges due to: – Introduction of new programming language Prerequisite courses are predominantly taught in Java Students struggle with C-language – Initiation to Linux Course introduces Linux and predominantly uses a Command Line Interface (CLI) based laboratory environment – A Significant change from a Graphical User Interface (GUI) driven Windows™ platform – Introduction and extensive use of PDC concepts A paradigmatic change from the traditional serial programming that the students are conversant with. Motivation
3
In Fall 2012, C++11 was used instead of C to ameliorate the steep learning curves faced by students – Continue to build upon student’s object-oriented skills – Use STL data structures to ease programming – Encouraged use of standard algorithms Supports automatic multi-threading via compiler flags Permit the use of C++ lambdas (makes programming convenient and concise) – Enables seamless use of system calls exposed only in C language – C++11 provides many modern design patterns for managing concurrency and parallelism Threading constructs are very streamlined and straightforward – Simplified, stream-based I/O For console I/O, files, sockets, and IPC-pipes Proposed using C++ rather than C
4
Sample C++ Code Fragments using namespace std; int main() { promise prom; async(launch::async, thread1, 99999, std::ref(prom)); future result = std::async(launch::async, thread2, 50000, std::ref(prom)); // Do some foreground work here! cout << "Result = ” << result.get() << std::endl; return 0; } using namespace std; int main() { promise prom; async(launch::async, thread1, 99999, std::ref(prom)); future result = std::async(launch::async, thread2, 50000, std::ref(prom)); // Do some foreground work here! cout << "Result = ” << result.get() << std::endl; return 0; }
5
Pedagogical experiences indicate C++11 was effective in teaching concurrency and parallelism – It alleviated the steep learning curve experienced by students Permitted coverage of pointers and explicit dynamic memory management later in the course when students were already comfortable with C++. – Helped to focus on core concepts rather than routine problem solving aspects – Effective for covering modern design patterns related to parallelism and concurrency Many of the terms and concepts are portable to other popular programming languages – Eases use of OS system calls and other C-language API Student experience and feedback was very positive – Course evaluations were very positive: 3.38 (SD: 0.84) out of 4.0 – Department plans to use C++11 in Fall 2013 – If experiences and student feedback remain positive, then C++11 will be permanently adopted Conclusions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.