Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

Running a Process on Another Thread

The term background process indicates that we want the process to run without blocking (pausing or "hanging") our main process, which is the UI. In the world of the Windows OS, accomplishing that task involves threads. Threads represent the CPU's view of your program, as a series of commands that are executed in sequence. A single process—your application or another program such as Microsoft Word—will consist of one or more "threads of execution." When combined with the thread-scheduling and multitasking features of the operating system, multiple threads produce the appearance of multiple series of commands being executed concurrently, even on a single-processor system.

Writing a program so that it uses more than a single thread to run is called multithreading, and this is a very powerful tool. Before Visual Basic .NET, multithreading was not a normal activity for most Visual Basic programmers because of the complexity and the limitations of Visual Basic 6.0 and earlier. Even when people managed to use multiple threads from their VB code, the results were usually unstable and multithreading was not often recommended. With the arrival of .NET, threading is one of the many features provided not by the Visual Basic. NET language itself, but instead as part of the runtime that underlies all of the .NET languages. As a result, Visual Basic .NET has the same multithreading capabilities as C#, and manipulating threads is no longer an unstable programming technique. It is worth noting, however, that multithreading is still quite complex to accomplish successfully.

  • + Share This
  • 🔖 Save To Your Account