Free Sample
+ Collection

C++ Multithreading Cookbook

Miloš Ljumović

Over 60 recipes to help you create ultra-fast multithreaded applications using C++ with rules, guidelines, and best practices.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783289790
Paperback422 pages

About This Book

  • Create multithreaded applications using the power of C++
  • Upgrade your applications with parallel execution in easy-to-understand steps
  • Stay up to date with new Windows 8 concurrent tasks
  • Avoid classical synchronization problems
  • Understand Windows API and concurrent execution

Who This Book Is For

The book is intended for enterprise developers and programmers who wish to make use of C++ capabilities to learn the multithreaded approach. Knowledge of multithreading along with experience in C++ is an added advantage. However it is not a prerequisite.

Table of Contents

Chapter 1: Introduction to C++ Concepts and Features
Creating a C++ project
Program structure, execution flow, and runtime objects
The structural programming approach
Understanding the object-oriented programming approach
Explaining inheritance, overloading, and overriding
Understanding polymorphism
Event handlers and Message Passing Interface
Linked list, queue, and stack examples
Chapter 2: The Concepts of Process and Thread
Processes and threads
Explaining the process model
Implementation of processes
IPC – Interprocess Communication
Solving classical IPC problems
Implementation of the thread model
Thread usage
Implementing threads in user space
Implementing threads in the kernel
Chapter 3: Managing Threads
Processes versus threads
Permissive versus preemptive multitasking
Explaining the Windows Thread object
Basic thread management
Implementing threads without synchronization
Using synchronized threads
Win32 synchronization objects and techniques
Chapter 4: Message Passing
Explaining the Message Passing Interface
Understanding a message queue
Using the thread message queue
Communicating through the pipe object
Chapter 5: Thread Synchronization and Concurrent Operations
Understanding process and thread priority
The Windows dispatcher object and scheduling
Using mutex
Using semaphore
Using event
Using critical section
Using pipes
Chapter 6: Threads in the .NET Framework
Managed versus unmanaged code
How threading works in .NET
The difference between foreground and background threads
Understanding the .NET synchronization essentials
Locking and avoiding deadlocks
Thread safety and types of the .NET framework
Signaling with event wait handles
Event-based Asynchronous Pattern
Using the BackgroundWorker class
Interrupting, aborting, and safe canceling the thread execution
Non-blocking synchronization
Signaling with Wait and Pulse
The Barrier class
Chapter 7: Understanding Concurrent Code Design
How to design parallel applications
Understanding parallelism in code design
Turning on to a parallel approach
Improving the performance factors
Chapter 8: Advanced Thread Management
Using thread pools
Customizing the thread pool dispatcher
Using remote threading

What You Will Learn

  • Use an object-oriented programming model with inheritance, overloading, and polymorphism
  • Solve common Interprocess Communication problems and avoid deadlocks or starvation problems in your application development
  • Manage threads efficiently using the CThread class
  • Explore .NET CLI/C++ features as well as synchronization objects and techniques
  • Make use of parallel techniques in code design
  • Use machine resources in concurrent execution
  • Enable programs to work with each other using Message Passing
  • Avoid classic synchronization problems

In Detail

Creating multithreaded applications is a present-day approach towards programming. With the power of C++, you can easily create various types of applications and perform parallelism and optimizations in your existing work. This book is a practical, powerful, and easy-to-understand guide to C++ multithreading. You will learn how to benefit from the multithreaded approach and enhance your development skills to build better applications. This book will not only help you avoid problems when creating parallel code, but also help you to understand synchronization techniques. The end goal of the book will be to impart various multithreading concepts that will enable you to do parallel computing and concurrent programming quickly and efficiently.


Read More