Автор: James Cutajar
Издательство: Manning Publications
Год: 2024
Страниц: 392
Язык: английский
Формат: epub
Размер: 16.6 MB
Write concurrent code in Go that improves application performance, scales up to handle bigger loads, and takes full advantage of modern multi-processor hardware.
In Learn Concurrent Programming with Go you will learn how to:
Implement effective concurrency for more responsive, higher performing, scalable software
Avoid common concurrency problems such as deadlocks and race conditions
Manage concurrency using goroutines, mutexes, readers-writer locks, and more
Identify concurrency patterns such as pipelining, worker pools, and message passing
Discover advantages, limits and properties of parallel computing
Improve your Go coding skills with advanced multithreading
Learn Concurrent Programming with Go teaches you how to use concurrency to improve the performance of your Go applications. Each chapter poses a new problem that can be solved using concurrency and introduces the right approach to implement it in Go. In this easy-to-read tutorial, you’ll delve into concurrency patterns, learn to dodge the most common pitfalls, and take advantage of Go’s innovative approach to concurrency. Practical exercises at the end of each chapter help you practice your new skills to lock in what you’ve learned.
about the technology
Concurrent programming is essential for getting the most out of modern multi-processor computer hardware. It allows multiple tasks to execute and interact simultaneously, speeding up performance and reducing user wait time. Thanks to its baked-in concurrency models, Google’s Go is one of the best languages you can use to learn and apply concurrent programming to your systems.
about the book
Learn Concurrent Programming with Go teaches you how to boost the performance of your systems through the power of concurrent programming. It demystifies concurrency, explaining complex topics using simple language, easy-to-follow visuals, and relevant examples you’ll face every day as a developer. You’ll get an under-the-hood understanding of concurrency by building common concurrency tools like readers/writer locks, semaphores, and thread pools. By the time you’re done reading, you’ll be effortlessly coding concurrent applications in Go. You’ll also have a great foundation to apply your new concurrency skills in almost any other language.
If you have little or no experience in concurrency but have some experience in Go or a similar C-style language, this book is ideal. This book starts with a gentle introduction to concurrency concepts in the operating system and describes how Go uses them to model concurrency. We’ll then move on to explain race conditions and why they occur in some concurrent programs. Later, we’ll discuss the two main ways we can implement communication between our executions: memory sharing and message passing. In the final chapters of this book, we’ll discuss concurrency patterns, deadlocks, and some advanced topics such as spinning locks.
By the end of the book, you will be able to:
- Use concurrency to create more responsive, higher performance and scalable software.
- Recognize and avoid common concurrency programming problems such as deadlocks and race conditions.
- Employ common currency patterns in your code.
- Improve your programming skills with more advanced, multithreading topics.
This book has three parts with 12 chapters. Part 1 introduces the fundamentals of concurrent programming and communication using memory sharing:
• Chapter 1 introduces concurrent programming and talks about some of the laws governing parallel execution.
• Chapter 2 discusses the various ways we can model concurrency and the abstractions provided by operating systems and the Go runtime. The chapter also compares concurrency and parallelism.
• Chapter 3 talks about inter-thread communication using memory sharing, and it introduces race conditions.
• Chapter 4 explores different types of mutexes as solutions to some race conditions. It also shows how to implement a basic readers-writer lock.
...
• Chapter 11 illustrates how deadlock situations can develop when we have concurrency and describes various techniques for avoiding them.
• Chapter 12 deals with the internals of mutexes. It explains how mutexes are implemented in both the kernel and user space.
Who should read this book:
This book is for readers who already have some programming experience and would like to learn about concurrency. The book assumes no prior knowledge of concurrent programming. Though the ideal reader would already have some experience with Go or another C-syntax-like language, this book is also well suited for developers coming from any language—if some effort is spent learning Go’s syntax.
Concurrent programming adds another dimension to your programming: programs stop being a set of instructions executing one after the other. This makes it a challenging topic, and it requires you to think about programs in a different way. Thus, being already proficient in Go is not as important as possessing curiosity and drive. This book does not focus on explaining Go’s syntax and features but instead uses Go to demonstrate concurrency principles and techniques. Most of these techniques can be applied to other languages.
Скачать Learn Concurrent Programming with Go (Final)