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

What this book covers

Chapter 1, An Introduction to System Programming, introduces you to Go and system programming and provides some basic concepts and an overview of Unix and its resources, including the kernel API. It also defines many concepts that are used throughout the rest of the book.

Chapter 2, Unix OS Components, focuses on the Unix operating system and the components that you will interact with—files and the filesystem, processes, users and permissions, threads, and others. It also explains the various memory management techniques of the operating system, and how Unix handles resident and virtual memory.

Chapter 3, An Overview of Go, takes a look at Go, starting with some history of the language and then explaining, one by one, all its basic concepts, starting with namespaces and the type system, variables, and flow control, and finishing with built-in functions and the concurrency model, while also offering an explanation of how Go interacts and manages its memory.

Chapter 4, Working with the Filesystem, helps you to understand how the Unix filesystem works and how to master the Go standard library to handle file path operations, file reading, and file writing.

Chapter 5, Handling Streams, helps you to learn about the interfaces for the input and output streams that Go uses to abstract data flows. It explains how they work and how to combine them and best use them without leaking information.

Chapter 6, Building Pseudo-Terminals, helps you understand how a pseudo-terminal application works and how to create one. The result will be an interactive application that uses standard streams just as the command line does.

Chapter 7, Handling Processes and Daemons, provides an explanation of what processes are and how to handle them in Go, how to start child processes from a Go application, and how to create a command-line application that will stay in the background (a daemon) and interact with it.

Chapter 8, Exit Codes, Signals, and Pipes, discusses Unix inter-process communication. It explains how to use exit codes effectively. It shows you how signals are handled by default inside an application, and how to manage them with some patterns for effective signal handling. Furthermore, it explains how to connect the output and input of different processes using pipes.

Chapter 9, Network Programming, explains how to use a network to make processes communicate. It explains how network communication protocols work. It initially focuses on low-level socket communication, such as TCP and UDP, before moving on to web server development using the well-known HTTP protocol. Finally, it shows how to use the Go template engine.

Chapter 10, Data Encoding Using Go, explains how to leverage the Go standard library to encode complex data structures in order to facilitate process communications. It analyzes both text-based protocols, such as XML and JSON, and binary-based protocols, such as GOB.

Chapter 11, Dealing with Channels and Goroutines, explains the basics of concurrency and channels and some general rules that prevent the creation of deadlocks and resource-leaking inside an application.

Chapter 12, Synchronization with sync and atomic, discusses the synchronization packages of the sync and sync/atomic standard libraries, and how they can be used instead of channels to achieve concurrency easily. It also focuses on avoiding the leaking of resources and on recycling resources.

Chapter 13, Coordination Using Context, discusses Context, a relatively new package introduced in Go that offers a simple way of handling asynchronous operations effectively.

Chapter 14, Implementing Concurrency Patterns, uses the tools from the previous three chapters and demonstrates how to use and combine them to communicate effectively. It focuses on the most common patterns used in Go for concurrency.

Chapter 15, Using Reflection, explains what reflection is and whether you should use it. It shows where it's used in the standard library and guides you in creating a practical example. It also shows how to avoid using reflection where there is no need to.

Chapter 16, Using CGO, explains how CGO works and why and when you should use it. It explains how to use C code inside a Go application, and vice versa.

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 $19.99/month. Cancel anytime