Systems Programming with C# And . NET : Building Robust System Solutions with C# 12 And . NET 8 / Dennis Vroegop.

Author
Vroegop, Dennis [Browse]
Format
Book
Language
English
Εdition
First edition.
Published/​Created
  • Birmingham, England : Packt Publishing, [2024]
  • ©2024
Description
1 online resource (474 pages)

Details

Subject(s)
Summary note
Kickstart systems programming with C# 12 and .NET Core 8, learn low-level secrets, optimize performance, and secure deployments for high-performance application development Key Features Engage in hands-on exercises to effectively apply systems programming concepts Gain insights into Linux and embedded systems and broaden your development capabilities Learn how to deploy and maintain applications securely in diverse production environments Purchase of the print or Kindle book includes a free PDF eBook Book Description If you want to explore the vast potential of C# and .NET to build high-performance applications, then this book is for you. Written by a 17-time awardee of the Microsoft MVP award, this book delves into low-level programming with C# and .NET. The book starts by introducing fundamental concepts such as low-level APIs, memory management, and performance optimization. Each chapter imparts practical skills, guiding you through threads, file I/O, and network protocols. With a focus on real-world applications, you'll learn how to secure systems, implement effective logging, and deploy applications seamlessly. The book particularly emphasizes debugging, profiling, and addressing challenges unique to multithreaded and asynchronous code. You'll also gain insights into cybersecurity essentials to help you safeguard data and establish secure communications. Moreover, a dedicated chapter on systems programming in Linux will help you broaden your horizons and explore cross-platform development. For those venturing into embedded systems, the final chapter offers hands-on guidance. By the end of this book, you'll be ready to deploy, distribute, and maintain applications in production systems. What you will learn Explore low-level APIs for enhanced control and performance Optimize applications with memory management strategies Develop secure, efficient networking applications using C# and .NET Implement effective logging, monitoring, and metrics for system health Navigate Linux environments for cross-platform proficiency Interact with hardware devices, GPIO pins, and embedded systems Deploy and distribute apps securely with continuous integration and continuous deployment (CI/CD) pipelines Debug and profile efficiently, addressing multithreaded challenges Who this book is for This book is for C# developers and programmers looking to deepen their expertise in systems programming with .NET Core. Professionals aspiring to architect high-performance applications, system engineers, and those involved in deploying and maintaining applications in production environments will also find this book useful. A basic understanding of C# and .NET Core is recommended, making it suitable for developers who are getting started with systems programming in C# and .NET Core.
Bibliographic references
Includes bibliographical references and index.
Source of description
  • Description based on publisher supplied metadata and other sources.
  • Description based on print version record.
Contents
  • Cover
  • Title page
  • Copyright and credits
  • Dedication
  • Contributors
  • Table of Contents
  • Preface
  • Overview of Systems Programming
  • Let's define systems programming
  • When is a system user-facing and when is it not?
  • A better definition
  • Using C# and .NET in systems programming
  • Higher-level languages for systems programming
  • Kernel mode and user mode
  • Why use .NET?
  • What is .NET anyway?
  • .NET, .NET Framework, .NET Standard - what is all this?
  • Programming languages - a choice to make
  • Now what?
  • Setting up your development environment
  • Chapter 1: The One with the Low-Level Secrets
  • Technical requirements
  • What are low-level APIs, and how do they differ from higher-level abstractions?
  • Overview of .NET Core runtime components (CLR, BCL)
  • CLR
  • BCL
  • Using P/Invoke to call low-level APIs
  • Dealing with errors
  • Issues when debugging code with low-level APIs
  • Error handling
  • Interoperability
  • Debugging tools
  • Compatibility and portability
  • Documentation and community support
  • Next steps
  • Chapter 2: The One Where Speed Matters
  • Setting up the stage
  • Accessibility
  • Hosting costs
  • Planned obsolescence
  • Energy usage
  • Which integer is the fastest?
  • The CTS
  • Value types and reference types
  • Classes and structs
  • Floating-point numbers
  • Where types live - the difference between value types and reference types
  • The stack and the heap
  • Boxing and unboxing
  • Hidden boxing and unboxing
  • Choosing the right data structures and algorithms
  • Arrays, Lists, and LinkedLists
  • Stacks and queues
  • HashSets and lists
  • SortedList, SortedDictionary, and Dictionary
  • Dictionary or last of tuples/objects
  • For versus ForEach
  • Strings
  • Use StringBuilder for concatenation
  • Interning strings
  • Use String.Concat or String.Join
  • Comparison.
  • Preallocating StringBuilder
  • Writing unsafe code
  • Compiler optimizations
  • Aggressive optimization
  • The optimize flag
  • Chapter 3: The One with the Memory Games
  • An overview of the GC
  • GC and its generations
  • The LOH
  • Finalizers
  • IDisposable
  • Memory-saving tips and tricks
  • Unsafe code and pointers in C#
  • Chapter 4: The One with the Thread Tangles
  • Concurrency and threading - the basics
  • The beginnings of concurrency - the IRQ
  • Cooperative and preemptive multitasking
  • Threads in C#
  • Win32 threads
  • .NET threads
  • Tasks and Parallel Library - the TPL
  • Async/await
  • Task.Wait() and Task.Result
  • Synchronizing threads
  • Synchronization - how do we do that?
  • Synchronization with async/await
  • Canceling a thread
  • Thread-safe programming techniques
  • Lock()
  • Records
  • Avoid static members and classes
  • Using the volatile keyword
  • Concurrent collections in .NET
  • Chapter 5: The One with the Filesystem Chronicles
  • File writing basics
  • FileStream
  • Even faster - Win32
  • File reading basics
  • Reading binary data
  • Directory operations
  • The Path class
  • The Directory class
  • The DirectoryInfo class
  • File system monitoring
  • Asynchronous I/O
  • The naïve approach
  • Using CancellationTokens
  • BufferedStream
  • File system security
  • Encryption basics
  • Symmetric encryption and decryption
  • Asymmetric encryption and decryption
  • File compression
  • Compressing some data
  • Decompressing some data
  • Serialization - JSON and Binary
  • JSON serialization
  • Binary serialization
  • Chapter 6: The One Where Processes Whisper
  • Overview of IPC and its importance in modern computing
  • Windows Messages
  • A sample.
  • Working with pipes for local IPC
  • Named pipes
  • Anonymous pipes
  • Using sockets to establish network-based IPC
  • Networking 101
  • A TCP-based chat app
  • UDP
  • Using shared memory to exchange data between processes
  • Overview of RPCs and how to use them for IPC
  • JSON RPC
  • Overview of gRPC and how to use it for IPC
  • Differences between JSON RPC and gRPC
  • Chapter 7: The One with the Operating System Tango
  • Technical requirement
  • The Windows Registry
  • What is the Windows Registry?
  • How to access and store data with the Windows Registry
  • Comparing the Windows Registry to JSON settings files
  • Worker Services
  • Docker support
  • Dissecting the Worker Service
  • Controlling the lifetime of the service
  • Wrapping up Worker Services
  • WMI
  • How to use WMI
  • Reading the CPU temperature
  • Reading the BIOS
  • Controlling the Windows Update service
  • Watching USB devices
  • Registry and WMI - risks and how to avoid them
  • Potential risks when dealing with WMI
  • Chapter 8: The One with the Network Navigation
  • The fundamentals
  • A walk down the OSI layers
  • Exploring the System.Net namespace
  • Understanding HTTP/HTTPS
  • FTP
  • Email protocols
  • Working with the System.Net.Sockets namespace
  • Steps to take when using sockets
  • IPv4 and IPv6
  • Looking up time with sockets
  • Async, non-blocking networking
  • Making asynchronous calls
  • Networking performance
  • Connection pooling
  • Caching
  • Compression and serialization
  • Keep-alive connections
  • Networking errors and time-outs
  • Using the HTTPClient wisely
  • Implementing retries with Polly
  • The circuit breaker pattern
  • Validating network availability
  • Monitoring and logging
  • Chapter 9: The One with the Hardware Handshakes
  • Technical requirements.
  • Connecting to serial ports
  • The path to the hardware
  • Why do we care?
  • A word about parity, data sizes, and stop bits
  • Working with an Arduino
  • Receiving serial data with .NET
  • Faking a serial device
  • Making it foolproof
  • Reasons things go haywire
  • Hardening your code
  • Chapter 10: The One with the Systems Check-Ups
  • Available logging frameworks
  • Default logger in .NET
  • NLog
  • Serilog
  • Comparing the logging frameworks
  • Monitoring your applications
  • Monitoring with Seq
  • Performance counters
  • Prometheus
  • Other platforms for monitoring
  • What you should be monitoring or logging
  • Chapter 11: The One with the Debugging Dances
  • Introducing debugging
  • Debugging and profiling - an overview
  • Debugging
  • Profiling
  • Debugging 101
  • Debug builds versus Release builds
  • Breakpoints
  • Debug windows
  • Diagnostic Tools
  • Debugging multithreaded and asynchronous code
  • Parallel Watch
  • Debugging deadlocks with Parallel Stacks and Thread windows
  • Profiling application performance
  • The prime application
  • Profiling in Visual Studio
  • Benchmarking different solutions
  • Other tools
  • Profiling tools
  • Chapter 12: The One with the Security Safeguards
  • Security for system programmers
  • What could happen if we have a vulnerability?
  • How to protect yourself
  • Working with strings
  • Protecting settings
  • Reading encrypted data
  • Where are the keys?
  • Handling strings in memory
  • Using key management
  • Using the Azure Key Vault
  • Using environment variables
  • Using the right privilege level
  • Admin-level scenarios
  • Impersonating as an admin
  • How to transmit network data securely
  • How HTTPS works
  • Certificates and certificate authorities.
  • Creating a development certificate
  • Securing TCP streams
  • Chapter 13: The One with the Deployment Dramas
  • From development to production
  • Publishing and file copy
  • Publish using Visual Studio
  • Publishing using the CLI
  • Using Azure DevOps and GitHub
  • Deploying to Azure
  • Enabling continuous integration in Azure DevOps
  • Enabling CI from GitHub
  • Building installers with Visual Studio
  • Building a simple installer
  • Writing a Custom Action
  • Incorporating the custom action in the setup
  • Using Docker
  • Adding Docker support to your background worker
  • Deploying your Docker images
  • Production-ready Docker repository
  • Chapter 14: The One with the Linux Leaps
  • An overview of Linux
  • A short history of Linux
  • What is Linux?
  • A quick primer to use Linux
  • Basic commands
  • Elevated privileges
  • Developing for Linux
  • Installing .NET on Linux
  • Running a .NET background worker on Linux
  • Make your code cross-platform
  • How code can help you
  • Writing services for Linux
  • The service description
  • Installing the service
  • Uninstalling the service
  • Handling signals
  • Summing up
  • Let's recap
  • Index
  • Other Books You May Enjoy
  • OLE_LINK1
  • OLE_LINK1.
ISBN
9781835083284 ((electronic bk.))
OCLC
1446416285
Statement on language in description
Princeton University Library aims to describe library materials in a manner that is respectful to the individuals and communities who create, use, and are represented in the collections we manage. Read more...
Other views
Staff view

Supplementary Information