Concurrency
Stephen Cleary
Avoid common asynchronous programming errors and master techniques to take full advantage of the new async/await support in the Microsoft .NET Framework 4.5.
March
2013
Kenny Kerr
Explore the evolution of threading in Windows and C++ to understand the threading capabilities in your programs and work with concurrency building blocks.
January
2013
Kenny Kerr
Some excellent synchronization primitives in Windows and the state-of-the-art C++ compiler make a compelling toolkit for producing lightweight and scalable concurrency-safe programs, says Kenny Kerr, who explains that there’s still work to be done to improve concurrency in the Standard C++ Library.
November
2012
Jesus Aguilar
The Task Parallel Library (TPL) provides all the necessary infrastructure to achieve optimal utilization of CPU resources within a single multicore computer. Now you can also implement an approach that scales across computer’s boundaries--useful for workload automation and batch processing scenarios.
October
2012
Kenny Kerr
Kenny Kerr concludes his three-part series on concurrency in C++, and explores an even more fluid approach to writing efficient and composable asynchronous systems.
October
2012
Andrew Pardoe
Coding in the .NET Framework means that you don’t normally have to worry about the many differences between ARM and x86-based processors. But there are a few fundamental design differences that may affect your code, as CLR team insider Andrew Pardoe explains here.
August
2012
Kenny Kerr
Kenny Kerr describes a technique—ideal for very lightweight concurrency—to write asynchronous code in C or C++ without the use of a runtime (such as those provided by Visual C++ and Windows).
August
2012
Lynn Langit
What’s all the buzz about Hadoop? Find out as you learn how to set up a cluster on Windows Azure, how to run a Map/Reduce job using Java, JavaScript and C# Streaming, how to run queries in HIVE, and more.
July
2012
Immo Landwerth
The .NET Framework 4.5 brings a number of improvments, big and small, to the base class library. Immo Landwerth explores these new features.
June
2012
Daniel Moth
The C++ compiler shipping with Visual Studio 11 adds heterogeneous platform support through a technology called C++ Accelerated Massive Parallelism. C++ AMP is a data parallel API that enables developers to take advantage of the performance of accelerators such as GPUs for executing their data parallel algorithms. This article introduces the C++ AMP API.
April
2012
Daniel Moth
In C++ AMP, the most common and first step to dialing up performance gains to the next level is through a technique called tiling. This article picks up where Daniel Moth’s introduction to C++ AMP left off, and explains how to tile your C++ AMP algorithms.
April
2012
Diego Dagum
Explore the new Visual C++ technologies that allow applications to run independent or semi-independent activities in parallel and provide mechanisms for synchronizing the way these activities handle data to avoid race conditions.
March
2012
Artur Laksberg
Asynchronous operations are essential for building responsive and scalable applications, but using the raw WinRT API for this requires writing lots of boiler-plate code. The Parallel Patterns Library offers a new task-based programming model that makes using asynchronous operations easy and productive.
February
2012
Kenny Kerr
Kenny Kerr finishes his series on the Windows 7 thread pool by delving into the two remaining callback-generating objects provided by the API—timer objects and I/O completion objects.
December
2011
Kenny Kerr
Blocking operations are bad news for concurrency. You need a way for the thread pool to wait on your behalf without affecting its concurrency limits. It can then queue a callback once the resource is available or the time has elapsed. Along with work objects, the thread pool API provides a number of other callback-generating objects. Here, Kenny Kerr shows how to use wait objects.
November
2011
Eric Lippert
There are many different techniques for achieving a responsive user interface in a program that performs high-latency operations, but the difficulty factor of doing so is high. The next version of C# and Visual Basic will include a new form of asynchronous control flow that avoids both the dangers of multithreading and the pain of writing callback methods.
October
2011
Mads Torgersen
Asynchronous methods in the upcoming versions of Visual Basic and C# are a great way to get the callbacks out of your asynchronous programming. Mads Torgersen takes a closer look at what the new await keyword actually does, starting at the conceptual level and working down to the iron.
October
2011
Stephen Toub
It’s easy to get started writing asynchronous methods in C# and Visual Basic, but there can be hidden performance costs. Stephen Toub explores the ins and outs of asynchronous methods to give you a solid understanding of how they’re implemented under the covers and show some of the more nuanced costs involved.
October
2011
Kenny Kerr
Cancellation and cleanup are notoriously difficult problems to solve when it comes to multi-threaded applications. However, the thread pool environment enables cleanup groups, which make the thread pool’s objects and callbacks more manageable, as Kenny Kerr details.
October
2011
Ron Fosner
Getting the most out of multicore systems means diving head-first into multithreaded programming. Ron Fosner follows up on his previous article by introducing you to a more sophisticated multithreading technique called task-based programming.
November
2010
Ron Fosner
Getting the most out of multicore systems means diving head-first into multithreaded programming. In this issue, Ron Fosner demonstrates some simple methods for adding parallel operation to your code, along with techniques for measuring how much you’ve improved execution.
October
2010
Doug Turnure
From functional IDE improvements to better support for parallel programming, Visual Studio 2010 comes with a host of new features to help meet the needs of today’s demanding, ever-changing development environment. Doug Turnure provides an overview of the more important ones and practical advice on how to use them.
April
2010
Hazim Shafi
Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.
March
2010
Ted Neward
STM.NET allows developers to mark their code with ACID-style transactional semantics, and leaves the grunt work of managing locks to the underlying environment.
January
2010
Igor Ostrovsky
Multicore processors are now ubiquitous on mainstream desktop computers, but applications that use their full potential are still difficult to write. Version 4 of the .NET Framework will deliver several tools that programmers can employ to make this task easier. This article explores the use of one of those tools: Parallel LINQ (PLINQ).
December
2009
Rick Molloy
This article describes how to integrate the new parallel computing libraries in the Visual Studio 2010 Beta into existing C++ projects. Based on four common scenarios, the column explains a few of the ways developers can use the APIs and classes that are part of the Parallel Pattern Library (PPL), Asynchronous Agents Library, and Concurrency Runtime.
October
2009
Chris Dern, Roy Tan
As more and more multi-threaded software applications get developed, software development professionals need to adopt new tools, techniques and metrics that can deal with multi-threaded software. Synchronization coverage is a simple, practical way to do this and this article covers a prototype synchronization coverage tool for .NET, called Sync Cover.
September
2009
Stephen Toub, Daniel Moth
In Visual C++ 10 and the Microsoft .NET Framework 4, Microsoft is introducing new libraries and runtimes to significantly ease the process of expressing parallelism in your code base, together with new tool support for performance analysis and debugging of parallel applications. In this article, you will learn about debugging support in Visual Studio 2010, much of which is focused on task-based programming models.
September
2009
Subramanian Ramaswamy and Vance Morrison
Memory usage can have a direct impact on how fast an application executes and thus is important to optimize. In this article we discuss the basics of memory optimization for .NET programs.
June
2009
Rick Molloy
We use the new Asynchronous Agents Library in Visual C++ 2010 to solve the classic Dining Philosophers concurrency problem.
June
2009
Stephen Toub
In this month’s installment, Stephen Toub examines some techniques for enforcing dependencies in the running order of asynchronous operations and builds a DependencyManagement class to help.
April
2009
Stephen Toub
This month we demonstrate how you can use the ThreadPool to support ordered execution without having to build custom thread pools yourself.
February
2009
Stephen Toub
Stephen Toub shows you how to add round-robin scheduling support on top of the ThreadPool for more granular processing control.
January
2009
Erika Fuentes and Eric Eilebrecht
Getting the performance you want in concurrent applications is not as straightforward as you might think. See how common threading issues can affect your application.
December
2008
David Callahan
This article presents an overview of the motivation behind new techniques that decompose problems into independent pieces for optimal use of parallel programming.
October
2008
Stephen Toub and Hazim Shafi
We take a look at planned support for parallel programming for both managed and native code in the next version of Visual Studio.
October
2008
Joe Duffy
Here we describe some of the more common challenges to concurrent programming and present advice for coping with them in your software.
October
2008
Chance Coble
In this article, the author explores how the F# language helps you create asynchronous function libraries that can be called seamlessly from any other .NET-compliant language.
October
2008
Howard Dierking
Introducing the issue, Howard Dierking points out that you can't simply parallelize your code blindly if you expect to truly reap the benefits that parallelism promises.
October
2008
Stephen Toub, Igor Ostrovsky, and Huseyin Yildiz
This month: memory access issues in multi-core systems and diagnosing and avoiding false sharing in your parallel computing applications.
October
2008
Josh Phillips
With today's processing power at your disposal, Josh Phillips recommends speculative computation—performing operations ahead of time even if you may never need the results.
October
2008
Jeffrey Richter
Jeffrey Richter shows you some additional cool features of his AsyncEnumerator class.
August
2008
Stephen Toub
In this month’s installment of .NET Matters, columnist Stephen Toub answers reader questions concerning asynchronous I/O .
July
2008
Rahul V. Patil and Boby George
Efficient parallel applications aren’t born by merely running an old app on a parallel processor machine. Tuning needs to be done if you’re to gain maximum benefit.
June
2008
Jeffrey Richter
Here Jeffrey Richter introduces his AsyncEnumerator class, which drives an iterator so that different thread pool threads can execute the same code at different times.
June
2008
Richard Campbell and Kent Alstad
Performance problems can creep into your Web app as it scales up, and when they do, you need to find the causes and the best strategies to address them.
April
2008
Howard Dierking
Howard Dierking talks to the inventor of C++, Bjarne Stroustrup, about language zealots, the evolution of programming, and what’s in the future of programming.
April
2008
Stephen Toub
This month Stephen Toub discusses asynchronous stream processing.
March
2008
Stephen Toub
This month Stephen Toub explains how to make the most of dual processors when running encryption and compression tasks.
February
2008
Jeffrey Richter
Jeffrey Richter introduces his AsyncEnumerator class and explains how it harnesses some recent additions to the C# programming language that make working with the asynchronous programming model significantly easier.
November
2007
Robert Saccone
The new threadpool APIs in Windows Vista and in the upcoming Windows Server 2008 provide advances that even native Windows developers can benefit from.
October
2007
Shawn Wildermuth
Understanding the Windows Presentation Foundation threading model helps when creating user interfaces that are both compelling and responsive.
October
2007
Joe Duffy and Ed Essey
Use Parallel Language Integrated Query (PLINQ) to take advantage of multi-processor computers and the newer wave of multi-core processors.
October
2007
Daan Leijen and Judd Hall
While multi-core processors have become increasingly common, most applications still fail to take advantage of multiple cores. Here's an overview of creating multithreaded applications that benefit from these new processors.
October
2007
Kenny Kerr
The new Task Scheduler in Windows Vista can do so much more than previous versions. We introduce some basic concepts and building blocks you can put to use in your own scheduled task projects.
October
2007
Stephen Toub
This month Stephen Toub discusses deadlocks that can occur when synchronizing threads.
October
2007
Dino Esposito
This month Dino explains how to remotely cancel tasks running on the server using ASP.NET AJAX.
August
2007
Jason Olson
Presented here is an overview of Transactional NTFS and how it revolutionizes transactions.
July
2007
John Robbins
Windows Vista has a new API called Wait Chain Traversal (WCT), which allows you to determine when and why a process is deadlocked. Read on.
July
2007
Robert Saccone and Alexander Taskov
Windows Vista has lots of goodies for native C++ developers including condition variables, slim reader/writer locks, and one-time initialization.
June
2007
Jeffrey Richter
Jeff Richter uses the AsyncResult class to implement the CLR’s Asynchronous Programming Model to perform hardware device operations asynchronously.
June
2007
Stephen Toub
Many developers who use the Microsoft .NET Framework think that application type is tied to the libraries that can be used in that application. Stephen Toub clarifies.
June
2007
Jeffrey Richter
March
2007
John Papa
John Papa builds a Windows Mobile 5.0 application that reads RSS feeds and loads them into an ADO.NET DataSet.
December
2006
Jeffrey Richter
November
2006
Jeff Prosise
Jeff Prosise describes performance problems in an ASMX Web service that relied on legacy COM and Visual Basic 6.0 to perform key processing tasks and the approach he took to find a fix.
October
2006
Joe Duffy
Because of the popularity of multiprocessor machines, many concurrency articles focus on how to make concurrency safe in your code. However, they don't deal with how to get concurrency into your code in the first place.
September
2006
Jeffrey Richter
What can a robot-programming toolkit do for you? Read on and find out.
September
2006
Stephen Toub
This month Stephen Toub explains how you can get some of the functionality found in the TransactionScope class in your own classes.
September
2006
Fritz Onion
Building a customizable Web site complete with a collection of pluggable Web Parts is fairly easy with the portal infrastructure of ASP. NET 2. 0. This model is very flexible, allowing users to easily place your Web Parts anywhere on the Web page so they are free to customize your site.
July
2006
Jeffrey Richter
If multiple threads concurrently execute code that writes to or modifies a resource, then obviously the resource must be protected with a thread synchronization lock to ensure that the resource doesn't get corrupted.
June
2006
Stephen Toub
This month Stephen Toub answers readers questions that include: How do I pass data to a new thread? Why can't I convert from "ref string" to "ref object"? And what's the difference between EventWaitHandle, AutoResetEvent and ManualResetEvent?
June
2006
Joe Duffy
You can combat deadlock using a combination of disciplined locking practices which Joe Duffy aptly explains in this article.
April
2006
Jeffrey Richter
In my last column, I showed the various thread synchronization mechanisms employed by the Microsoft® . NET Framework (see Concurrent Affairs: Performance-Conscious Thread Synchronization). I then examined the performance characteristics of all these mechanisms and determined that the Interlocked methods performed the best because the calling thread never has to transition to kernel mode.
March
2006
Vance Morrison
Because the use of low-lock techniques in your application significantly increases the likelihood of introducing hard-to-find bugs, it is best to use them only when absolutely necessary. Here Vance Morrison demonstrates the limitations and subtleties low-lock techniques so that if you are forced to use them you have a better chance of using them correctly.
October
2005
Kang Su Gatlin and Pete Isensee
Having more than one CPU core on a single chip makes a system with a processor with two cores operate just like a dual-processor computer, and a system with a processor with four cores operate like a quad-processor computer, so you get much better performance. But if your application does not take advantage of these multiple cores, you may not reap the benefits. OpenMP helps you create multithreaded C++ applications more quickly so the benefits of multithreading can be realized.
October
2005
Jeff Prosise
ASP.NET 2.0 is replete with new features ranging from declarative data binding and Master Pages to membership and role management services. But my vote for the coolest new feature goes to asynchronous pages, and here's why.
October
2005
Jeffrey Richter
In my career, I have architected and implemented many thread synchronization techniques. This has provided me with a lot of experience that has shaped the way I now think about thread synchronization problems.
October
2005
Vance Morrison
Multithreading offers lots of benefits, but it's not a technique you can employ willy nilly without first learning about all the potential pitfalls. To get you started, Vance Morrison covers multithreading and the shared memory threading model, race conditions and how concurrent access can break invariants. He also discusses how to use locks so you can understand the costs involved.
August
2005
Daryn Kiely
The Win32 Windows Sockets library (Winsock) provides mechanisms to improve the performance of programs that use sockets, and the Microsoft .NET Framework provides a layer over Winsock so that managed applications can communicate over sockets. To use all these layers to write a truly high-performance socket-based application requires a little background information, as Daryn Kiely explains here.
August
2005
Matt Adamson
Errors happen. But in production, error logs often provide little or no help in pinpointing the exact line of code in which the problem originates. You can't usually isolate the root cause by modifying code in a production environment because recreating the exact same environment is very difficult due to the large number of potential software and hardware configurations. This article provides some concrete steps you can take to get at the heart of the problems in your production code.
July
2005
Yaniv Pessach
In this article, the author explores the hyper-threading technology found on newer Intel Pentium 4 processors and demonstrates how adding parallelism to your code can improve performance on hyper-threaded machines. He covers advanced optimizations for hyper-threading and shows a number of useful patterns. Code samples are in C#, but you can apply the same principles in other languages as they apply to both managed and unmanaged applications.
June
2005
Jeff Prosise
In the February 2005 issue, I introduced five lesser-known features of ASP. NET 2. 0 that have the potential to make a significant impact on the security, performance, and robustness of your code (see Wicked Code: Five Undiscovered Features on ASP.
June
2005
Stephen Toub
In last month's . NET Matters column, I answered a question concerning the PropertyGrid control, specifically about using it with classes that expose fields instead of properties. I demonstrated how the ICustomTypeDescriptor interface in the Microsoft® .
May
2005
Ken Getz
If you've been following Ted Pattison's excellent series of Basic Instincts columns on multithreading and asynchronous behavior, you should by now be an expert on handling the issues involved in working with multiple threads in Windows®-based apps.
March
2005
Ted Pattison
In several installments over the past year I have written about multithreading programming techniques in Visual Basic® . NET. In the September 2004 issue of MSDN®Magazine, I discussed the need for thread synchronization and how to write thread-safe code using monitors.
February
2005
Stephen Toub
February
2005
Stephen Toub
December
2004
Stephen Toub
November
2004
Stephen Toub
October
2004
Ted Pattison
My last three Basic Instincts columns have examined techniques for using asynchronous delegates and creating secondary threads. Those columns demonstrated how to introduce multithreaded behavior into your applications.
September
2004
Alex Calvo
Timers often play an important role in both client applications and server-based components (including Windows services). Writing effective timer-driven managed code requires a clear understanding of program flow and the subtleties of the .NET threading model. The .NET Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. This article examines the three timer classes and helps you gain an understanding of how and when each class should be used.
February
2004
Ted Pattison
January
2004
Matt Pietrek and Russ Osterlund
Critical sections, a mechanism that prohibits more than one thread at a time from executing a particular section of code, is a topic that has not received much attention and thus tends not to be well understood. A solid understanding of critical sections in Windows can really come in handy when you need to track down multithreading performance issues in your code. This articles delves under the hood of critical sections to reveal information useful in finding deadlocks and in pinpointing performance problems. It also includes a handy utility program that shows all of your critical sections and their current states.
December
2003
Ajai Shankar
Coroutines are a powerful feature of many programming languages including CLU, Scheme, Python, Ruby, and ICON. Coroutines can save processor overhead and reduce redundancy because they allow you to stop execution of a procedure midstream, return a value, and resume exactly where the procedure left off.This article shows how coroutines can be implemented for the .NET Framework by using the Fiber API and Managed Extensions for C++, and how they can be easily used with other .NET-compliant languages. This article also shows a sophisticated use of the runtime host for running multiple managed threads on a single OS thread.
September
2003
Fritz Onion
Fortunately for developers, threading in ASP.NET is a lot easier than it was in ASP. In this article, the author takes a look at threading in the ASP.NET HTTP pipeline, and explains how threads are managed efficiently without the involvement of the developer. The article considers how the common language runtime threadpool is used by ASP.NET to service requests, looks at the pooling mechanisms used for handlers, modules, and applications, and covers both IIS 5.0 and IIS 6.0 and how they differ in their approach to request processing and thread allocation. Finally, how and when to use asynchronous handlers is discussed for developers who still need to use threads in their own applications.
June
2003
Jeffrey Richter
How does the thread pool work in the CLR?
June
2003
Ian Griffiths
If your application performs any non-UI processing on the thread that controls the user interface, it may make the app seem slow and sluggish, frustrating users. But writing multithreaded apps for Windows has long been restricted to C++ developers. Now with the .NET Framework, you can take advantage of multiple threads in C# to control the flow of instructions in your programs and isolate the UI thread for a fast and snappy user interface. This article shows you how. Also, it discusses the pitfalls of multiple threads and presents a framework for safe concurrent thread execution.
February
2003
Jeffrey Richter
By far, the most common use of thread synchronization is to ensure mutually exclusive access to a shared resource by multiple threads. In the Win32® API, the CRITICAL_SECTION structure and associated functions offers the fastest and most efficient way to synchronize threads for mutually exclusive access when the threads are all running in a single process.
January
2003
Mark Gerlach
Visual Basic .NET comes loaded with features not available in previous versions, including a new threading model, custom class creation, and data streaming. Learn how to take advantage of these features with an application that is designed to extract information from Web pages for indexing purposes. This article also discusses basic database access, file I/O, extending classes for objects, and the use of opacity and transparency in forms.
October
2002
Pranish Kumar and Bogdan Crivat
SOAP opens up a new world of Web Services, letting you make function calls across a network or the Internet. But this flexibility creates new problems when your app needs to wait for calls to return from halfway around the world. What you need is an asynchronous SOAP client that takes advantage of threading to continue execution while waiting for calls over the wire. This article covers the basics of building such a client with ATL.
April
2002
Edited by Nancy Michell
February
2002
Ian Emmons
Application performance involves more than just speed. In a Web server environment, top performance also means ensuring that the maximum numbers of users can be served concurrently. This can be accomplished through efficient use of multiprocessor machines and thread management. This article presents techniques that can solve a number of concurrency problems. One approach, using thread management, controls access to a database on a per-thread basis, which protects the integrity of the data. In the article, reusable thread classes are built and presented. The classes are then tested and their performance in a live environment is examined.
August
2001
Richard Grimes
One of the many great features of the .NET Framework is that it has asynchronous infrastructure built in. In .NET you can call any method asynchronously by defining a delegate for the method and calling the delegate's asynchronous methods. This is beneficial to your application because when a synchronous call is made, the calling thread is blocked until the method completes whereas an asynchronous call is made on a different thread, and this allows the original thread to continue its work while the asynchronous call is in progress.This article explains delegates in .NET and how to use them to perform asynchronous calls, eliminating age-old threading problems.
August
2001
Yasser Shohoud
Visual Basic has always been a language of innovation, but at the same time it's left its proponents wanting certain high-level features. With the upcoming version, Visual Basic .NET, the language takes advantage of the Microsoft .NET Framework to provide several new features that will be vital to developers. This article begins by discussing tracing and error logging in Visual Basic .NET. Next, you'll see how to write a Windows service without third-party help. Monitoring the file system, a previously daunting task, is also covered. Finally, the author ties these concepts together with a sample application that waits for XML files to be deposited in a directory and then imports them into SQL Server database.
July
2001
Paul Yao
Windows CE is a small, configurable, feature-rich, real-time operating system. In Windows CE 3.0, the real-time support has been improved. This article looks at specific support for the creation of real-time systems and how it compares to the support in Windows for the desktop. The way interrupt handlers, processes, memory management, and synchronization work in Windows CE 3.0 is discussed. An extensive look at threads and thread priority, misconceptions surrounding them, and their impact on performance is included. Refinements to the Windows CE scheduler and support for nestable interrupts are also covered.
November
2000
Anthony Jones and Amol Deshpande
Writing a network-aware application isn't difficult, but writing one that is scalable can be challenging. Overlapped I/O using completion ports provides true scalability on Windows NT and Windows 2000. Completion ports and Windows Sockets 2.0 can be used to design applications that will scale to thousands of connections. The article begins with a discussion of the implementation of a scalable server, discusses handling low-resource, high-demand conditions, and addresses the most common problems with scalability.
October
2000
Jeffrey Richter
July
2000
Jeff Prosise
Windows 2000 is the first version of COM to support asynchronous method calls, which permit clients to make nonblocking calls to COM objects and objects to process incoming calls without blocking the calling threads. COM clients benefit from asynchronous method calls because they can continue working while waiting for outbound calls to return. Objects benefit because they can queue incoming calls and service them from a thread pool. Our SieveClient and SieveServer sample apps demonstrate how to create and use asynchronous clients and servers in COM-based distributed applications.
April
2000