𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Systems Programming with C# and .NET: Building robust system solutions with C# 12 and .NET 8

✍ Scribed by Dennis Vroegop


Publisher
Packt Publishing
Year
2024
Tongue
English
Leaves
474
Edition
1
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


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 DescriptionIf 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...

    ✦ Table of Contents


    Systems Programming with C# and .NET
    Contributors
    About the author
    About the reviewers
    Preface
    Who this book is for
    What this book covers
    To get the most out of this book
    Download the example code files
    Conventions used
    Get in touch
    Share Your Thoughts
    Download a free PDF copy of this book
    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
    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
    2
    The One Where Speed Matters
    Technical requirements
    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
    Next steps
    3
    The One with the Memory Games
    Technical requirements
    GC and its generations
    The LOH
    Finalizers
    IDisposable
    Memory-saving tips and tricks
    Unsafe code and pointers in C#
    Next steps
    4
    The One with the Thread Tangles
    Technical requirements
    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
    Next steps
    5
    The One with the Filesystem Chronicles
    Technical requirements
    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
    Next steps
    6
    The One Where Processes Whisper
    Technical requirements
    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
    Next steps
    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
    The Windows Registry
    Potential risks when dealing with WMI
    Next steps
    8
    The One with the Network Navigation
    Technical requirements
    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
    Next steps
    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
    Next steps
    10
    The One with the Systems Check-Ups
    Technical requirements
    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
    Next steps
    11
    The One with the Debugging Dances
    Technical requirements
    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
    Debugging tools
    Profiling tools
    Next steps
    12
    The One with the Security Safeguards
    Technical requirements
    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
    Next steps
    13
    The One with the Deployment Dramas
    Technical requirements
    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
    Next steps
    14
    The One with the Linux Leaps
    Technical requirements
    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
    Why subscribe?
    Other Books You May Enjoy
    Packt is searching for authors like you
    Share Your Thoughts
    Download a free PDF copy of this book


    πŸ“œ SIMILAR VOLUMES


    Systems Programming with C# and .NET: Bu
    ✍ Dennis Vroegop πŸ“‚ Library πŸ“… 2024 πŸ› Packt Publishig Pvt Ltd 🌐 English

    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 e

    Systems Programming with C# and .NET: Bu
    ✍ Dennis Vroegop πŸ“‚ Library πŸ“… 2024 πŸ› Packt Publishing 🌐 English

    <p><span>Kickstart systems programming with C# 12 and .NET Core 8, learn low-level secrets, optimize performance, and secure deployments for high-performance application development </span></p><h4><span>Key Features</span></h4><ul><li><span><span>Engage in hands-on exercises to effectively apply sys

    Systems Programming with C# and .NET: Bu
    ✍ Dennis Vroegop πŸ“‚ Library πŸ“… 2024 πŸ› Packt Publishing 🌐 English

    <p><span>Kickstart systems programming with C# 12 and .NET Core 8, learn low-level secrets, optimize performance, and secure deployments for high-performance application development </span></p><h4><span>Key Features</span></h4><ul><li><span><span>Engage in hands-on exercises to effectively apply sys

    Hands-On Network Programming with C# and
    ✍ Sean Burns πŸ“‚ Library πŸ“… 2019 πŸ› Packt Publishing 🌐 English

    <p><span>A comprehensive guide to understanding network architecture, communication protocols, and network analysis to build secure applications compatible with the latest versions of C# 8 and .NET Core 3.0</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Explore various network archi

    Hands-On System Programming with C++ Bui
    ✍ Dr. Rian Quinn πŸ“‚ Library πŸ“… 2018 πŸ› Packt Publishing 🌐 English

    C++ is a general-purpose programming language with a bias toward system programming as it provides ready access to hardware-level resources, efficient compilation, and a versatile approach to higher-level abstractions. This book will help you understand the benefits of system programming with C++

    Hands-On System Programming with C++ Bui
    ✍ Rian Quinn πŸ“‚ Library πŸ“… 2018 πŸ› Packt Publishing 🌐 English

    C++ is a general-purpose programming language with a bias toward system programming as it provides ready access to hardware-level resources, efficient compilation, and a versatile approach to higher-level abstractions. This book will help you understand the benefits of system programming with C++