万本电子书0元读

万本电子书0元读

顶部广告

Extreme C电子书

售       价:¥

11人正在读 | 0人评论 9.8

作       者:Kamran Amini

出  版  社:Packt Publishing

出版时间:2019-10-31

字       数:1127.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Push the limits of what C - and you - can do, with this high-intensity guide to the most advanced capabilities of C Key Features * Make the most of C’s low-level control, flexibility, and high performance * A comprehensive guide to C’s most powerful and challenging features * A thought-provoking guide packed with hands-on exercises and examples Book Description There’s a lot more to C than knowing the language syntax. The industry looks for developers with a rigorous, scientific understanding of the principles and practices. Extreme C will teach you to use C’s advanced low-level power to write effective, efficient systems. This intensive, practical guide will help you become an expert C programmer. Building on your existing C knowledge, you will master preprocessor directives, macros, conditional compilation, pointers, and much more. You will gain new insight into algorithm design, functions, and structures. You will discover how C helps you squeeze maximum performance out of critical, resource-constrained applications. C still plays a critical role in 21st-century programming, remaining the core language for precision engineering, aviations, space research, and more. This book shows how C works with Unix, how to implement OO principles in C, and fully covers multi-processing. In Extreme C, Amini encourages you to think, question, apply, and experiment for yourself. The book is essential for anybody who wants to take their C to the next level. What you will learn * Build advanced C knowledge on strong foundations, rooted in first principles * Understand memory structures and compilation pipeline and how they work, and how to make most out of them * Apply object-oriented design principles to your procedural C code * Write low-level code that’s close to the hardware and squeezes maximum performance out of a computer system * Master concurrency, multithreading, multi-processing, and integration with other languages * Unit Testing and debugging, build systems, and inter-process communication for C programming Who this book is for Extreme C is for C programmers who want to dig deep into the language and its capabilities. It will help you make the most of the low-level control C gives you.
目录展开

Why subscribe?

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

Reviews

Essential Features

Preprocessor directives

Macros

Defining a macro

Variadic macros

Advantages and disadvantages of macros

Conditional compilation

Variable pointers

Syntax

Arithmetic on variable pointers

Generic pointers

Size of a pointer

Dangling pointers

Some details about functions

Anatomy of a function

Importance in design

Stack management

Pass-by-value versus pass-by-reference

Function pointers

Structures

Why structures?

Why user-defined types?

What do structures do?

Memory layout

Nested structures

Structure pointers

Summary

From Source to Binary

Compilation pipeline

Building a C project

Header files versus source files

Example source files

Building the example

Step 1 – Preprocessing

Step 2 – Compilation

Step 3 – Assembly

Step 4 – Linking

Supporting new architectures

Step details

Preprocessor

Compiler

Abstract syntax tree

Assembler

Linker

How does the linker work?

Linker can be fooled!

C++ name mangling

Summary

Object Files

Application binary interface (ABI)

Object file formats

Relocatable object files

Executable Object Files

Static libraries

Dynamic libraries

Manual loading of shared libraries

Summary

Process Memory Structure

Process memory layout

Discovering memory structure

Probing static memory layout

BSS segment

Data segment

Text segment

Probing dynamic memory layout

Memory mappings

Stack segment

Heap segment

Summary

Stack and Heap

Stack

Probing the Stack

Points on using the Stack memory

Heap

Heap memory allocation and deallocation

Heap memory principles

Memory management in constrained environments

Memory-constrained environments

Packed structures

Compression

External data storage

Performant environments

Caching

Allocation and deallocation cost

Memory pools

Summary

OOP and Encapsulation

Object-oriented thinking

Mental concepts

Mind maps and object models

Objects are not in code

Object attributes

Domain

Relations among objects

Object-oriented operations

Objects have behaviors

C is not object-oriented, but why?

Encapsulation

Attribute encapsulation

Behavior encapsulation

Information hiding

Summary

Composition and Aggregation

Relations between classes

Object versus class

Composition

Aggregation

Summary

Inheritance and Polymorphism

Inheritance

The nature of inheritance

The first approach for having inheritance in C

The second approach to inheritance in C

Comparison of two approaches

Polymorphism

What is polymorphism?

Why do we need polymorphism?

How to have polymorphic behavior in C

Summary

Abstraction and OOP in C++

Abstraction

Object-oriented constructs in C++

Encapsulation

Inheritance

Polymorphism

Abstract classes

Summary

Unix – History and Architecture

Unix history

Multics OS and Unix

BCPL and B

The way to C

Unix architecture

Philosophy

Unix onion

Shell interface to user applications

Kernel interface to shell ring

Kernel

Hardware

Summary

System Calls and Kernels

System calls

System calls under the microscope

Bypassing standard C – calling a system call directly

Inside the syscall function

Add a system call to Linux

Kernel development

Writing a Hello World system call for Linux

Building the kernel

Unix kernels

Monolithic kernels versus microkernels

Linux

Kernel modules

Adding a kernel module to Linux

Summary

The Most Recent C

C11

Finding a supported version of C standard

Removal of the gets function

Changes to fopen function

Bounds-checking functions

No-return functions

Type generic macros

Unicode

Anonymous structures and anonymous unions

Multithreading

A bit about C18

Summary

Concurrency

Introducing concurrency

Parallelism

Concurrency

Task scheduler unit

Processes and threads

Happens-before constraint

When to use concurrency

Shared states

Summary

Synchronization

Concurrency issues

Intrinsic concurrency issues

Post-synchronization issues

Synchronization techniques

Busy-waits and spin locks

Sleep/notify mechanism

Semaphores and mutexes

Multiple processor units

Spin locks

Condition variables

Concurrency in POSIX

Kernels supporting concurrency

Multi-processing

Multithreading

Summary

Thread Execution

Threads

POSIX threads

Spawning POSIX threads

Example of race condition

Example of data race

Summary

Thread Synchronization

POSIX concurrency control

POSIX mutexes

POSIX condition variables

POSIX barriers

POSIX semaphores

POSIX threads and memory

Stack memory

Heap memory

Memory visibility

Summary

Process Execution

Process execution APIs

Process creation

Process execution

Comparing process creation and process execution

Process execution steps

Shared states

Sharing techniques

POSIX shared memory

Data race example using shared memory

File system

Multithreading versus multi-processing

Multithreading

Single-host multi-processing

Distributed multi-processing

Summary

Process Synchronization

Single-host concurrency control

Named POSIX semaphores

Named mutexes

The first example

The second example

Step 1 – Global declarations

Step 2 – Cancellation flag's shared memory

Step 3 – Named mutex's shared memory

Step 4 – Setting the cancellation flag

Step 5 – The main function

Named condition variables

Step 1 – Class of shared memory

Step 2 – Class of shared 32-bit integer counter

Step 3 – Class of shared mutex

Step 4 – Class of shared condition variable

Step 5 – The main logic

Distributed concurrency control

Summary

Single-Host IPC and Sockets

IPC techniques

Communication protocols

Protocol characteristics

Content type

Length of messages

Sequentiality

Single-host communication

File descriptors

POSIX signals

POSIX pipes

POSIX message queues

Unix domain sockets

Introduction to socket programming

Computer networks

Physical layer

Link layer

Network layer

Transport layer

Application layer

Internet protocol suite

What is socket programming?

What is a socket?

POSIX socket library

Sockets have their own descriptors!

Summary

Socket Programming

Socket programming review

Calculator project

Source hierarchy

Build the project

Run the project

Application protocol

Serialization/deserialization library

Server-side serializer/deserializer functions

Client-side serializer/deserializer functions

Calculator service

Unix domain sockets

UDS stream server

UDS stream client

UDS datagram server

UDS datagram client

Network sockets

TCP server

TCP client

UDP server

The UDP client

Summary

Integration with Other Languages

Why integration is possible?

Obtaining the necessary materials

Stack library

Integration with C++

Name mangling in C++

C++ code

Integration with Java

Writing the Java part

Writing the native part

Integration with Python

Integration with Go

Summary

Unit Testing and Debugging

Software testing

Unit testing

Test doubles

Component testing

Testing libraries for C

CMocka

Google Test

Debugging

Bug categories

Debuggers

Memory checkers

Thread debuggers

Performance profilers

Summary

Build Systems

What is a build system?

Make

CMake – not a build system!

Ninja

Bazel

Comparing build systems

Summary

Epilogue

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部