Systems Programming with C# And . NET Building Robust System Solutions with C# 12 And . NET 8
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 embedd...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
[2024]
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009841737406719 |
Tabla de Contenidos:
- 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
- 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
- Chapter 3: The One with the Memory Games
- Technical requirements
- An overview of the GC
- GC and its generations
- The LOH
- Finalizers
- IDisposable
- Memory-saving tips and tricks
- Unsafe code and pointers in C#
- Next steps
- Chapter 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
- Chapter 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
- Chapter 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
- 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
- The Windows Registry
- Potential risks when dealing with WMI
- Next steps
- Chapter 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
- 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
- Next steps
- Chapter 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
- Chapter 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
- Chapter 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
- Chapter 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
- Chapter 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
- Other Books You May Enjoy
- OLE_LINK1
- OLE_LINK1.