Learn it from developers who built it.
Tutorials, how-tos and deep dives on AI, .NET, C#, cloud and developer tools, written by the community.
Unlock the secrets of synchronous vs. asynchronous execution! Learn how each handles tasks, impacts performance, and when to choose async for optimal efficiency.
Learn how C# async methods and await prevent blocking, and when to use Task, Task, ValueTask, and async void.
Master batch processing in C# using async/await! Learn how to efficiently handle large workloads, improve performance, and scale your applications. Real-world examples included.
Explore safer alternatives like ConcurrentDictionary for thread-safe mutable access with fine-grained locking, and ImmutableDictionary for guaranteed thread safety through immutability. Understand the performance trade-offs between speed and safety when choosing the right collection type for concurrent operations.
Parallel.For in C# allows executing loops in parallel, improving performance by utilizing multiple processors or cores. It enhances scalability but introduces overhead and requires thread safety for shared resources.
A summary of C# multithreading concepts, comparing Thread, ThreadPool, and Task, and reviewing APM, EAP, and async/await patterns.
Learn how race conditions occur in C# multithreaded applications and how to protect critical sections and shared data with the lock keyword.
This article introduces multithreading in C# using the Task class from the Task Parallel Library (TPL). It explains creating and executing tasks serially within a loop, ensuring tasks are completed sequentially. An example demonstrates task creation and simulating work with delays.
Learn the differences between synchronous, asynchronous, blocking, non-blocking, concurrent, and parallel programming in C#, with practical examples using async and await.
Thread synchronization in C# ensures safe, correct access to shared resources in concurrent programming, preventing race conditions, data corruption, deadlocks, and livelocks through various mechanisms like locks, monitors, and semaphores.
Learn how optimistic and pessimistic locking address concurrency issues in .NET, including DataSet updates, SQL Server timestamps, and transaction isolation levels.
Multithreading allows a program to run multiple threads concurrently. This article explains how multithreading works in .NET. This article covers the entire range of threading areas from thread creation, race conditions, deadlocks, monitors, mutexes, synchronization and semaphores and so on.
Sometimes we need to call a method asynchronously and don’t want to wait until it completes execution.
When two or more threads need access to a shared resource, they need some way to ensure that the resource will be used by only one thread at a time. The process by which this is achieved is called synchronization.
Exclusive locking in C# threading ensures that one thread does not enter a critical section while another thread is in the critical section of code.
Here you will see how to make thread-safe calls using Windows Form Controls.
The preferred way to implement multithreading in your application is to use the BackgroundWorker component. The BackgroundWorker component uses an event-driven model for multithreading.
Async/Await are two keywords used by new generation apps to take advantage of Asynchronous Programming.
In this tutorial, learn how to implement a Timer in C#. The Timer control represented by the C# Timer class executes a code block at a specified interval of time repeatedly.
Compares three ways to check and raise C# events, explaining race conditions and why local delegate copies and the null-conditional operator are thread-safe.
C# Sleep() method of Thread class is useful when you need to pause a program in C#. Code examples how to use Thread.Join(), Thread.Sleep(), and Thread.Abort() methods in C#.
In this article you will see the other face of the delegate type in C#, it will show you how you can invoke a method asynchronously using delegates.
Learn how to make asynchronous delegate calls in C# using BeginInvoke, EndInvoke, IAsyncResult, and AsyncCallback to handle results and completion.
When dealing with asynchronous code, one of the most important concepts that you must have a solid understanding of is synchronization context.
In this article you will learn about Concurrency and the ConcurrentBag in C#.
Learn how to use Java Thread.join() to coordinate execution and how to name and identify threads with getName(), setName(), getId(), and currentThread().
Learn the basics of C# Thread. This code example explains how to create a Thread in C# and .NET Core.
This article is a complete introduction to Multithreading in C#. This tutorial explains what a thread in C# is and how C# threading works.
How to pass data to a thread in C#. In this article, I will demonstrate how to use the ThreadStart to pass data from your main program to a new thread using the ParameterizedThreadStart.
Everything on Threading, not only its articles: the Threading page →
Write an article and earn +1,000 SHARP when it is approved.
Write an article