SYSTEM PROGRAMMING ESSENTIALS WITH GO: system calls, networking, efficiency, and security practices with practical projects in Golang
Description
Go beyond the web, learn system programming with Go, and build efficient, secure applications Key Features Get to grips with system programming concepts in Go with application examples Gain expert guidance on essential topics like file operations, process management, and network programming Learn how to develop modern, functional applications from scratch Purchase of the print or Kindle book includes a free PDF eBook Book Description Alex Rios, a seasoned Go developer and active community builder, shares his 15 years of expertise in designing large-scale systems through this book. It masterfully cuts through complexity, enabling you to build efficient and secure applications with Go's streamlined syntax and powerful concurrency features. In this book, you'll learn how Go, unlike traditional system programming languages (C/C++), lets you focus on the problem by prioritizing readability and elevating developer experience with features like automatic garbage collection and built-in concurrency primitives, which remove the burden of low-level memory management and intricate synchronization. Through hands-on projects, you'll master core concepts like file I/O, process management, and inter-process communication to automate tasks and interact with your system efficiently. You'll delve into network programming in Go, equipping yourself with the skills to build robust, distributed applications. This book goes beyond the basics by exploring modern practices like logging and tracing for comprehensive application monitoring, and advance to distributed system design using Go to prepare you to tackle complex architectures. By the end of this book, you'll emerge as a confident Go system programmer, ready to craft high-performance, secure applications for the modern world. What you will learn Understand the fundamentals of system programming using Go Grasp the concepts of goroutines, channels, data races, and managing concurrency in Go Manage file operations and inter-process communication (IPC) Handle USB drives and Bluetooth devices and monitor peripheral events for hardware automation Familiarize yourself with the basics of network programming and its application in Go Implement logging, tracing, and other telemetry practices Construct distributed cache and approach distributed systems using Go Who this book is for This book is for software engineers looking to expand their understanding of system programming concepts. Professionals with a coding foundation seeking profound knowledge of system-level operations will also greatly benefit. Additionally, individuals interested in advancing their system programming skills, whether experienced developers or those transitioning to the field, will find this book indispensable.
More Details
ISBN
9781801813440
Table of Contents
From the eBook - 1st edition.
Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Part 1: Introduction
Chapter 1: Why Go?
Choosing Go
Concurrency and goroutines
Concurrency
Goroutines
CSP-inspired model
Share by communication
Interacting with the OS
Tooling
go build
go test
go run
go vet
go fmt
Cross-platform development with Go
Summary
Chapter 2: Refreshing Concurrency and Parallelism
Technical requirements
Understanding goroutines
WaitGroup
Changing shared state
Managing data races
Atomic operations
Mutexes
Making sense of channels
How to use channels
An unbuffered channel
Buffered channels
The guarantee of delivery
Latency
State and signaling
State
Signaling
Choosing your synchronization mechanism
Summary
Part 2: Interation with the OS
Chapter 3: Understanding System Calls
Technical requirements
Introduction to system calls
The catalog of services and identification
Information exchange
The syscall package
A closer look at the os and x/sys packages
x/sys package
low-level system calls
Operating system functionality
Portability
Everyday system calls
Tracing system calls
Tracing specific system calls
Developing and testing a CLI program
Standard streams
File descriptors
Creating a CLI application
Redirections and standard streams
Making it testable
Summary
Chapter 4: File and Directory Operations
Technical requirements
Identifying unsafe file and directory permissions
Files and permissions
Scanning directories in Go
Understanding file paths
Using the path/filepath package
Traversing directories
Symbolic links and unlinking files
Symbolic links
the shortcut of the file world
Unlinking files
the great escape act
Calculating directory size
Finding duplicate files
Optimizing filesystem operations
Summary
Chapter 5: Working with System Events
Managing system events
What are signals?
The os/signal package
Task scheduling in Go
Why schedule?
Basic scheduling
Handling timer signals
File monitoring
Inotify
fsnotify
File rotation
Process management
Execution and timeouts
Execute and control process execution time
Building a distributed lock manager in Go
Summary
Chapter 6: Understanding Pipes in Inter-Process Communication
Technical requirements
What are pipes in IPC?
Why are pipes important?
Pipes in Golang
The mechanics of anonymous pipes
Navigating named pipes (Mkfifo())
Best practices
guidelines for using pipes
Efficient data handling
Error handling and resource management
Security considerations
Performance optimization
Developing a log processing tool
Summary
Chapter 7: Unix Sockets
Introduction to Unix sockets
Creating a Unix socket
Going a little deeper into socket creation
Reviews from GoodReads
Loading GoodReads Reviews.
Staff View
Loading Staff View.