0% found this document useful (0 votes)
97 views

CSC 362 Multithreading C++ 2015

This document provides information about a C++ Multithreading course including the instructor details, meeting times, prerequisites, reference materials, learning objectives, grading breakdown, software requirements, topics to be covered, and course schedule. The course will cover fundamental multithreading concepts like threads, mutexes, and semaphores. Students will learn to design multithreaded applications and refactor single-threaded code into multithreaded solutions. Assignments include implementing basic threading, demonstrating code samples, converting a program to multithreading, and creating a thread pool system. The course is divided into three phases starting with basics, then refactoring, and finally thread management.

Uploaded by

Jiana Nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

CSC 362 Multithreading C++ 2015

This document provides information about a C++ Multithreading course including the instructor details, meeting times, prerequisites, reference materials, learning objectives, grading breakdown, software requirements, topics to be covered, and course schedule. The course will cover fundamental multithreading concepts like threads, mutexes, and semaphores. Students will learn to design multithreaded applications and refactor single-threaded code into multithreaded solutions. Assignments include implementing basic threading, demonstrating code samples, converting a program to multithreading, and creating a thread pool system. The course is divided into three phases starting with basics, then refactoring, and finally thread management.

Uploaded by

Jiana Nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

C++ Multithreading Spring 2015

CSC 362

instructor: Ed Keenan
email: [email protected]
office hours: Mon (4-5pm in office & 9-10pm in classroom) or by email appointment
office: CDM 830
phone: (312)362-6747
website: piazza.com/depaul/spring2015/csc462 (Preferred communication)
lecture: CDM 222, Monday 5:45-9:00pm
Desired to Learn (D2L): d2l.depaul.edu (Grades, Viewing lectures, Announcements)
Version Control: perforce: 140.192.39.61:1666

Description

Applied C++ concurrency and multithreading fundamentals. Basics threading concepts: process model,
threads, stacks, fibers, mutexes, semaphores, atomics and events. Understanding synchronous /
asynchronous interactions and behavior of threads. Using managed thread pools and queues in
applications. Understanding advanced C++ language features relating to the memory model and the
threading support.

Prerequisites

• GAM 371 - Optimized C++ or CSC 361 Optimized C++


o Implies CSC 393 & CSC 374

Reference Material

• C++ Concurrency in Action: Practical Multithreading, 2012 by Athony Williams


• Windows System Programming (4th Edition), 2010, Johnson Hart, ISBN: 978-0321657749
• The C++ Programming Language, 4th Edition - Bjarne Stroustrup

Learning Objectives

• Students will be able to demonstrate basic thread knowledge (threads, mutexes, semaphores,
atomics, events)
• Students will be able to create design multithread applications using Lock-Based concurrent
data structures.
CSC 362: C++ Multithreading

• Students will be able to debug multi-threaded environment (Deadlocks, Starvation, Priority


Syllabus - 29 March 2015

contention)
• Students will refactor single threaded applications into a multi-threaded solutions

1
Grading
• 20 % - Simplified Threading program
o Program using basic multithreading primitives
 Several fixed threads, Mutexes, Callbacks, Critical Sections
• 10% - Book Demos
o Sample code from book: Submitted to Perforce with commentary
• 30 % - Conversion problem
o Puzzle program or something similar
 Converting a single thread system into multiple threaded solution
• 30% - Managing multiple thread in pools
o Creating a threading pool system.
 Manage and control thread execution and priorities.
o Spawning multithreaded program
 Creating a dynamically spawning application of autonomous agents
 Design and implemented using the thread pool system
• 10 % - Final Exam

Software
• Microsoft Visual Studio 2012 (ultimate edition - Recommended)
o DePaul MSDNAA link Microsoft_Visual_Studio_Ultimate_2012
o C# and C++ install (future classes)
o Microsoft Visual Studio 2013 is not used in this class.
• Perforce - Visual Client (p4v)
o www.perforce.com
• Download and configuration instructions will be provided in class
o Server address: 140.192.39.61:1666

Topics:

Understanding the multi-threading primitives / basic concepts


• Managing Threads
• Sharing Data between Threads
• Synchronizing concurrent operations
• C++ Memory Model
• Lock-based current data structures
• Lock Free concurrent data structures
Design Software
• Dividing work between threads
• Thread Management
CSC 362: C++ Multithreading

• Debugging
Syllabus - 29 March 2015

• Testing
• C++ 11 Language Features
Primitives
• Threads
• Fibers

2
• Atomics
• Mutexes
• Semaphores
• Events

Phase 1 : Basics

• Programming Assignment
o (20%) PA1: Simplified Threading program
 Program using basic multithreading primitives
• Several fixed threads, Mutexes, Callbacks, Critical Sections
o Book Demos
 Sample code from book: Submitted to Perforce with commentary
• Week 1
o Introduction to Concurrency
o Launching a thread
o Waiting for a thread to complete
o Passing arguments to a thread
o Transferring ownership of a thread
• Week 2
o Sharing Data between thread
o Race conditions
o Protecting shared data with mutexes
o Deadlocks
o Flexible locking (C++ specifics)
o Transferring mutex ownership
o Recursive locking
• Week 3
o Synchronization concurrent operations
o Building a thread-safe queue
o Waiting for an event or other condition
o Waiting for one-off events with futures
o Return from background tasks, promise - future
o Waiting with a time limit
o Clocks, Timepoints
• Week 4
o C++ memory model
o Atomic Types in C++
o Synchronizing operations and enforcing ordering using Atomics
o Fences
CSC 362: C++ Multithreading
Syllabus - 29 March 2015

3
Phase 2: Refactoring existing solutions

• Programming Assignment
o (30%) PA2: Conversion problem
 Converting a single thread system into multiple threaded solution
• Example problems:
o NxN sliding puzzle
o Maze program
o Book Demos
 Sample code from book: Submitted to Perforce with commentary
• Week 5
o Lock-based concurrent data structures
o A thread-safe stack using locks
o A thread-safe queue using locks and condition variables
o A thread-safe queue using fine-grained locks and condition variable
o Writing a thread-safe list using locks
• Week 6
o Designing lock-free concurrent data structures
o Non blocking data structures
o Lock-free data structures
o Writing a thread-safe stack without locks
o ABA problem
• Week 7
o Designing concurrent code
o dividing work between threads
o Dividing work by task
o performance of concurrent code
o Oversubscription and excessive task switching
o Hiding latency with multiple threads
o Improving responsiveness with concurrency

CSC 362: C++ Multithreading


Syllabus - 29 March 2015

4
Phase 3: Threading system / management

• Programming Assignment
o (30%) PA3: Managing multiple thread in pools
 Creating a threading pool system.
• Manage and control thread execution and priorities.
 Spawning multithreaded program
• Creating a dynamically spawning application of autonomous agents
• Design and implemented using the thread pool system
 Examples:
• Interactive spawning / dispatch / threading system
o Genetic bug spawn / growth / death - Gui application
o or Desktop Tower Defense
o Book Demos
 Sample code from book: Submitted to Perforce with commentary
• Week 8
o Advanced thread management
o Thread pools
o Interrupting threads
o Launching and interrupting another thread
o Detecting that a thread has been interrupted
o Interrupting other blocking calls
• Week 9
o Debugging multithreaded applications
o Types of concurrency-related bugs
o Race conditions
o Unwanted blocking
o Locating concurrency-related bugs by testing
• Week 10
o Performance tuning
o Contest

Final Exam (10%)


Final exam covering the concepts and the material of the class
• In class exam
• Multithreading concepts
• Diagramming communication between threads
• Applied problems
CSC 362: C++ Multithreading
Syllabus - 29 March 2015

5
Perforce Submissions
• Everyone is expected to submit at least 10 submissions a week to perforce.
• The biggest reason students get into trouble with software design:
o Not working on the material frequently enough
o Taking too large of a bite of the design
• Both are fixed with this Perforce RULE
• Even my simplest programs take 10-20 submissions.
o For these project assignments my average is 40-400 submissions, so 10 will be no problem.
• Detailed perforce changelist comments are expected

Piazza Discussion forum


• Statistics show: students who participate more and help other students do better!
o The correlation is ridiculous!
• Poor understanding / poor participation.
• Great understanding / Great participation
o As you master the material, help others learn!
• You're in the master's program so master it!
• Everyone is expected and encouraged to participate on the Piazza discussion forum. All class-related
discussion here this term.
• The quicker you begin asking questions on Piazza (rather than via emails), the quicker you'll benefit
from the collective knowledge of your classmates and instructors. I encourage you to ask questions
when you're struggling to understand a concept.
• All correspondence that is not personal in nature should be vectored through Piazza
• Sensitive material, use Piazza private note, not email.
• Keep the forum professional and positive, help each other out.
o Karma really pays off here.
o Help each other whenever you can.
• There will be a section where you'll need help (trust me).

NOTE: Do NOT post until you have watched the entire lecture FIRST (in class or online)
This will prevent frustration on all sides (members asking or answering questions)
CSC 362: C++ Multithreading
Syllabus - 29 March 2015

6
Collaborating together on programming assignments

• You are encourage to work together


o Use the Piazza forums heavy
o Even share your material with others in the common directory
• Everyone is 100% responsible for the work they do.
o If you get help with a section of code,
o Please refactor the code the snot out of it
 Comment and understand that material
 Transform the code to make it yours
o Be able to answer any question regarding the code you commit
• System for Detecting Software Plagiarism
o We will be using MOSS - Measure of Software Similarity (Standford University)
 Indicates possible code infringements (plagiarism)
 MOSS - will detect the similarity independent of naming convention, indentation
style or formatting, it compares abstract syntax tree of your code.
• If you gain significant support / help from another student
o Fully disclose the support / help you had in a Readme.txt file submitted with your
assignments.
 Disclosing the help, is not permission for copying the code.
 Only there to clarify and acknowledge help you were given from a fellow student.
• Modifying any Unit Test to alter the outcome results is also an Academic Integrity Violation
• If you are stuck and find yourself even tempted to plagiarize
o Ask for help !!!!
 Use on Piazza -> Visit during offices hours, make an appointment
o Don't ever compromise your integrity!

CSC 362: C++ Multithreading


Syllabus - 29 March 2015

7
Schedule:
Week Lecture Work
Overview Chapter 1-2
1 C++ 11 Review PA1 - assignment
Thread Creation
Sharing Data Chapter 3
2 Deadlocks
Mutex
Synchronization Chapter 4
3 Waiting for Events
Clocks
C++ Memory Model Chapter 5
4 Atomic Types
Fences
Lock-Base concurrent structures Chapter6
5 Thread-safe Queues PA2 - assignment
PA1 - due before class
Lock-Free concurrent structures Chapter 7
6 Non-Blocking
ABA problem
Dividing work between threads Chapter 8
7 Oversubscription excessive switching
Improving responsiveness
Thread Pools Chapter 9
8 Interrupting Threads PA3 - assignment
Blocking calls
PA2 - due before class
Debugging multithreading Chapter 10
9 Race conditions
Unwanted blocking
Performance tuning
10 Contest

Final Exam
11 PA3 - due before exam

April 3, 2015 Last day to add classes to SQ2015 schedule


April 10, 2015 Last day to drop classes with no penalty, Last day to select pass/fail option
April 11, 2015 Grades of “W” assigned for SQ2015 classes dropped on or after this day
April 18, 2015 Last day to select auditor status
May 15, 2015 Last day to withdraw from SQ2015 classes
CSC 362: C++ Multithreading
Syllabus - 29 March 2015

8
Course Policies
Changes to Syllabus

This syllabus is subject to change as necessary during the quarter. If a change occurs, it will be thoroughly
addressed during class, posted under Announcements in D2L and sent via email.

Online Course Evaluations

Evaluations are a way for students to provide valuable feedback regarding their instructor and the course. Detailed
feedback will enable the instructor to continuously tailor teaching methods and course content to meet the
learning goals of the course and the academic needs of the students. They are a requirement of the course and are
key to continue to provide you with the highest quality of teaching. The evaluations are anonymous; the instructor
and administration do not track who entered what responses. A program is used to check if the student completed
the evaluations, but the evaluation is completely separate from the student’s identity. Since 100% participation is
our goal, students are sent periodic reminders over three weeks. Students do not receive reminders once they
complete the evaluation. Students complete the evaluation online in CampusConnect.

Academic Integrity and Plagiarism

This course will be subject to the university's academic integrity policy. More information can be found
at http://academicintegrity.depaul.edu/. If you have any questions be sure to consult with your professor.

Academic Policies

All students are required to manage their class schedules each term in accordance with the deadlines for enrolling
and withdrawing as indicated in the University Academic Calendar. Information on enrollment, withdrawal,
grading and incompletes can be found at: cdm.depaul.edu/enrollment.

Students with Disabilities

Students who feel they may need an accommodation based on the impact of a disability should contact the
instructor privately to discuss their specific needs. All discussions will remain confidential.
To ensure that you receive the most appropriate accommodation based on your needs, contact the instructor as
early as possible in the quarter (preferably within the first week of class), and make sure that you have contacted
the Center for Students with Disabilities (CSD) at: [email protected].

Lewis Center 1420, 25 East Jackson Blvd.


Phone number: (312)362-8002
Fax: (312)362-6544
TTY: (773)325.7296

Retroactive withdrawal
CSC 362: C++ Multithreading
Syllabus - 29 March 2015

This policy exists to assist students for whom extenuating circumstances prevented them from meeting the
withdrawal deadline. During their college career students may be allowed one medical/personal administrative
withdrawal and one college office administrative withdrawal, each for one or more courses in a single term.
Repeated requests will not be considered. Submitting an appeal for retroactive withdrawal does not guarantee
approval. Information on enrollment, withdrawal, grading and incompletes can be found at:
http://www.cdm.depaul.edu/Enrollment-Policies.aspx

You might also like