Chapter 10. Multitasking

In this chapter, we will look at D's multitasking capabilities with threads, fibers, and processes. We'll learn about the following:

  • Using threads
  • Passing messages with std.concurrency
  • Processing parallel data with std.parallelism
  • Using fibers
  • Creating new processes
  • Exploring thread-safe, single-locking singletons
  • Using asynchronous I/O

Introduction

Multitasking has several uses in modern computer programs. It can accelerate speed by utilizing multiple processor cores or continuing to crunch numbers while waiting on a file to load from secondary storage, such as a slow hard drive. It can improve scalability by spreading a task across several servers. Also, it can improve reliability by putting buggy components in separate processes that will crash independently of the main application.

D has support in the language and library for various forms of multitasking, including processes, threads, fibers, and single-instruction and multiple-data CPU features. By accessing operating system APIs, D can also utilize asynchronous I/O, among other features.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.19.174