Preface xiii Part 1: Asynchronous Programming Fundamentals 1 Concurrency and Asynchronous Programming: a Detailed Overview 3 Technical requirements 4 An evolutionary journey of multitasking 4 Non-preemptive multitasking 4 Preemptive multitasking 5 Hyper-threading 5 Multicore processors 6 Do you really write synchronous code? 6 Concurrency versus parallelism 7 The mental model I use 8 Let's draw some parallels to process economics 9 Concurrency and its relation to I/O 11 What about threads provided by the operating system? 12 Choosing the right reference frame 12 Asynchronous versus concurrent 12The role of the operating system 13 Concurrency from the operating system's perspective 13 Teaming up with the operating system 14 Communicating with the operating system 14 The CPU and the operating system 15 Down the rabbit hole 16 How does the CPU prevent us from accessing memory we're not supposed to access? 17 But can't we just change the page table in the CPU? 18 Interrupts, firmware, and I/O 19 A simplified overview 19 Interrupts 22 Firmware 22 Summary 23Table of Contents