Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On System Programming with Go

You're reading from   Hands-On System Programming with Go Build modern and concurrent applications for Unix and Linux systems using Golang

Arrow left icon
Product type Paperback
Published in Jul 2019
Publisher Packt
ISBN-13 9781789804072
Length 458 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Alex Guerrieri Alex Guerrieri
Author Profile Icon Alex Guerrieri
Alex Guerrieri
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Section 1: An Introduction to System Programming and Go FREE CHAPTER
2. An Introduction to System Programming 3. Unix OS Components 4. An Overview of Go 5. Section 2: Advanced File I/O Operations
6. Working with the Filesystem 7. Handling Streams 8. Building Pseudo-Terminals 9. Section 3: Understanding Process Communication
10. Handling Processes and Daemons 11. Exit Codes, Signals, and Pipes 12. Network Programming 13. Data Encoding Using Go 14. Section 4: Deep Dive into Concurrency
15. Dealing with Channels and Goroutines 16. Synchronization with sync and atomic 17. Coordination Using Context 18. Implementing Concurrency Patterns 19. Section 5: A Guide to Using Reflection and CGO
20. Using Reflection 21. Using CGO 22. Assessments 23. Other Books You May Enjoy

Combining channels and goroutines

Now that we know the fundamental tools and properties of Go concurrency, we can use them to build better tools for our applications. We will see some examples that make use of channels and goroutines to solve real-world problems.

Rate limiter

A typical scenario is having a web API that has a certain limit to the number of calls that can be done in a certain period of time. This type of API will just prevent the usage for a while if this threshold is crossed, making it unusable for the time being. When creating a client for the API, we need to be aware of this and make sure our application does not overuse it.

That's a very good scenario where we can use time.Ticker to define...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime