图书介绍

LINUX内核设计与实现 英文版 第3版 经典图书新版PDF|Epub|txt|kindle电子书版本网盘下载

LINUX内核设计与实现 英文版 第3版 经典图书新版
  • (美)洛夫著 著
  • 出版社: 北京:机械工业出版社
  • ISBN:7111327929
  • 出版时间:2011
  • 标注页数:440页
  • 文件大小:25MB
  • 文件页数:464页
  • 主题词:

PDF下载


点此进入-本书在线PDF格式电子书下载【推荐-云解压-方便快捷】直接下载PDF格式图书。移动端-PC端通用
种子下载[BT下载速度快]温馨提示:(请使用BT下载软件FDM进行下载)软件下载地址页直链下载[便捷但速度慢]  [在线试读本书]   [在线获取解压码]

下载说明

LINUX内核设计与实现 英文版 第3版 经典图书新版PDF格式电子书版下载

下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。

建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!

(文件页数 要大于 标注页数,上中下等多册电子书除外)

注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具

图书目录

1 Introduction to the Llnux Kernel1

History of Unix1

Along Came Linus: Introduction to Linux3

Overview of Operating Systems and Kernels4

Linux Versus Classic Unix Kernels6

Linux Kernel Versions8

The Linux Kernel Development Community10

Before We Begin10

2 Getting Started with the Kernel11

Obtaining the Kernel Source11

Using Git11

Installing the Kernel Source12

Using Patches12

The Kernel Source Tree12

Building the Kernel13

Configuring the Kernel14

Minimizing Build Noise15

Spawning Multiple Build Jobs16

Installing the New Kernel16

A Beast of a Dierent Nature16

No libc or Standard Headers17

GNU C18

Inline Functions18

Inline Assembly19

Branch Annotation19

No Memory Protection20

No (Easy) Use of Floating Point20

Small, Fixed-Size Stack20

Synchronization and Concurrency21

Importance of Portability21

Conclusion21

3 Process Management23

The Process23

Process Descriptor and the Task Structure24

Allocating the Process Descriptor25

Storing the Process Descriptor26

Process State27

Manipulating the Current Process State29

Process Context29

The Process Family Tree29

Process Creation31

Copy-on-Write31

Forking32

vfork()33

The Linux Implementation of Threads33

Creating Threads34

Kernel Threads35

Process Termination36

Removing the Process Descriptor37

The Dilemma of the Parentless Task38

Conclusion40

4 Process Schedullng41

Multitasking41

Linux's Process Scheduler42

Policy43

I/O-Bound Versus Processor-Bound Processes43

Process Priority44

Timeslice45

The Scheduling Policy in Action45

The Linux Scheduling Algorithm46

Scheduler Classes46

Process Scheduling in Unix Systems47

Fair Scheduling48

The Linux Scheduling Implementation50

Time Accounting50

The Scheduler Entity Structure50

The Virtual Runtime51

Process Selection52

Picking the Next Task53

Adding Processes to the Tree54

Removing Processes from the Tree56

The Scheduler Entry Point57

Sleeping and Waking Up58

Wait Queues58

Waking Up61

Preemption and Context Switching62

User Preemption62

Kernel Preemption63

Real-Time Scheduling Policies64

Scheduler-Related System Calls65

Scheduling Policy and Priority-Related System Calls66

Processor Affinity System Calls66

Yielding Processor Time66

Conclusion67

5 System Calls69

Communicating with the Kernel69

APIs, POSIX, and the C Library70

Syscalls71

System Call Numbers72

System Call Performance72

System Call Handler73

Denoting the Correct System Call73

Parameter Passing74

System Call Implementation74

Implementing System Calls74

Verifying the Parameters75

System Call Context78

Final Steps in Binding a System Call79

Accessing the System Call from User-Space81

Why Not to Implement a System Call82

Conclusion83

6 Kernel Data Structures85

Linked Lists85

Singly and Doubly Linked Lists85

Circular Linked Lists86

Moving Through a Linked List87

The Linux Kernel's Implementation88

The Linked List Structure88

Defining a Linked List89

List Heads90

Manipulating Linked Lists90

Adding a Node to a Linked List90

Deleting a Node from a Linked List91

Moving and Splicing Linked List Nodes92

Traversing Linked Lists93

The Basic Approach93

The Usable Approach93

Iterating Through a List Backward94

Iterating While Removing95

Other Linked List Methods96

Queues96

kfifo97

Creating a Queue97

Enqueuing Data98

Dequeuing Data98

Obtaining the Size of a Queue98

Resetting and Destroying the Queue99

Example Queue Usage99

Maps100

Initializing an idr101

Allocating a New UID101

Looking Up a UID102

Removing a UID103

Destroying an idr103

Binary Trees103

Binary Search Trees104

Self-Balancing Binary Search Trees105

Red-Black Trees105

rbtrees106

What Data Structure to Use, When108

Algorithmic Complexity109

Algorithms109

Big-O Notation109

Big Theta Notation109

Time Complexity110

Conclusion111

7 Interrupts and Interrupt Handlers113

Interrupts113

Interrupt Handlers114

Top Halves Versus Bottom Halves115

Registering an Interrupt Handler116

Interrupt Handler Flags116

An Interrupt Example117

Freeing an Interrupt Handler118

Writing an Interrupt Handler118

Shared Handlers119

A Real-Life Interrupt Handler120

Interrupt Context122

Implementing Interrupt Handlers123

/proc/interrupts126

Interrupt Control127

Disabling and Enabling Interrupts127

Disabling a Specific Interrupt Line129

Status of the Interrupt System130

Conclusion131

8 Bottom Halves and Deferrlng Work133

Bottom Halves134

Why Bottom Halves?134

A World of Bottom Halves135

The Original “Bottom Half”135

Task Queues135

Softirqs and Tasklets136

Dispelling the Confusion137

Softirqs137

Implementing Softirqs137

The Softirq Handler138

Executing Softirqs138

Using Softirqs140

Assigning an Index140

Registering Your Handler141

Raising Your Softirq141

Tasklets142

Implementing Tasklets142

The Tasklet Structure142

Scheduling Tasklets143

Using Tasklets144

Declaring Your Tasklet144

Writing Your Tasklet Handler145

Scheduling Your Tasklet145

ksoftirqd146

The Old BH Mechanism148

Work Queues149

Implementing Work Queues149

Data Structures Representing the Threads149

Data Structures Representing the Work150

Work Queue Implementation Summary152

Using Work Queues153

Creating Work153

Your Work Queue Handler153

SchedulingWork153

Flushing Work154

Creating New Work Queues154

The Old Task Queue Mechanism155

Which Bottom Half Should I Use?156

Locking Between the Bottom Halves157

Disabling Bottom Halves157

Conclusion159

9 An Introductlon to Kernel Synchronlzatlon161

Critical Regions and Race Conditions162

Why Do We Need Protection?162

The Single Variable163

Locking165

Causes of Concurrency167

Knowing What to Protect168

Deadlocks169

Contention and Scalability171

Conclusion172

10 Kernel Synchronlzatlon Methods175

Atomic Operations175

Atomic Integer Operations176

64-Bit Atomic Operations180

Atomic Bitwise Operations181

Spin Locks183

Spin Lock Methods184

Other Spin Lock Methods186

Spin Locks and Bottom Halves187

Reader-Writer Spin Locks188

Semaphores190

Counting and Binary Semaphores191

Creating and Initializing Semaphores192

Using Semaphores193

Reader-Writer Semaphores194

Mutexes195

Semaphores Versus Mutexes197

Spin Locks Versus Mutexes197

Completion Variables197

BKL: The Big Kernel Lock198

Sequential Locks200

Preemption Disabling201

Ordering and Barriers203

Conclusion206

11 Timers and Time Management207

Kernel Notion of Time208

The Tick Rate: HZ208

The Ideal HZ Value210

Advantages with a Larger HZ210

Disadvantages with a Larger HZ211

Jiffies212

Internal Representation of Jiffies213

Jiffies Wraparound214

User-Space and HZ216

Hardware Clocks and Timers216

Real-Time Clock217

System Timer217

The Timer Interrupt Handler217

The Time of Day220

Timers222

Using Timers222

Timer Race Conditions224

Timer Implementation224

Delaying Execution225

Busy Looping225

Small Delays226

schedule timeout()227

schedule timeout () Implementation228

Sleeping on a Wait Queue, with a Timeout229

Conclusion230

12 Memory Management231

Pages231

Zones233

Getting Pages235

Getting Zeroed Pages236

Freeing Pages237

kmalloc()238

gfp mask Flags238

Action Modifiers239

Zone Modifiers240

Type Flags241

kfree()243

vmalloc()244

Slab Layer245

Design of the Slab Layer246

Slab Allocator Interface249

Allocating from the Cache250

Example of Using the Slab Allocator251

Statically Allocating on the Stack252

Single-Page Kernel Stacks252

Playing Fair on the Stack253

High Memory Mappings253

Permanent Mappings254

Temporary Mappings254

Per-CPU Allocations255

The New percpu Interface256

Per-CPU Data at Compile-Time256

Per-CPU Data at Runtime257

Reasons for Using Per-CPU Data258

Picking an Allocation Method259

Conclusion260

13 The Vlrtual Fllesystem261

Common Filesystem Interface261

Filesystem Abstraction Layer262

Unix Filesystems263

VFS Objects and Their Data Structures265

The Superblock Object266

Superblock Operations267

The Inode Object270

Inode Operations271

The Dentry Object275

Dentry State276

The Dentry Cache276

Dentry Operations278

The File Object279

File Operations280

Data Structures Associated with Filesystems285

Data Structures Associated with a Process286

Conclusion288

14 The Block I/O Layer289

Anatomy of a Block Device290

Buffers and Buffer Heads291

The bio Structure294

I/O vectors295

The Old Versus the New296

Request Queues297

I/O Schedulers297

The Job of an I/O Scheduler298

The Linus Elevator299

The Deadline I/O Scheduler300

The Anticipatory I/O Scheduler302

The Complete Fair Queuing I/O Scheduler303

The Noop I/O Scheduler303

I/O Scheduler Selection304

Conclusion304

15 The Process Address Space305

Address Spaces305

The Memory Descriptor306

Allocating a Memory Descriptor308

Destroying a Memory Descriptor309

The mm struct and Kernel Threads309

Virtual Memory Areas309

VMA Flags311

VMA Operations312

Lists and Trees of Memory Areas313

Memory Areas in Real Life314

Manipulating Memory Areas315

find_vma()316

find_vma_prev()317

find_vma_intersection()317

mmap () and do_mmap () : Creating an Address Interval318

munmap() and do_munmap(): Removing an Address Interval320

Page Tables320

Conclusion322

16 The Page Cache and Page Writeback323

Approaches to Caching323

Write Caching324

Cache Eviction324

Least Recently Used325

The Two-List Strategy325

The Linux Page Cache326

The address space Object326

address_space Operations328

Radix Tree330

The Old Page Hash Table330

The Buffer Cache330

The Flusher Threads331

Laptop Mode333

History: bdflush, kupdated, and pdflush333

Avoiding Congestion with Multiple Threads334

Conclusion335

17 Devices and Modules337

Device Types337

Modules338

Hello, Worldl338

Building Modules340

Living in the Source Tree340

Living Externally342

Installing Modules342

Generating Module Dependencies342

Loading Modules343

Managing Configuration Options344

Module Parameters346

Exported Symbols348

The Device Model348

Kobjects349

Ktypes350

Ksets351

Interrelation of Kobjects, Ktypes, andKsets351

Managing and Manipulating Kobjects352

Reference Counts353

Incrementing and Decrementing Reference Counts354

Krefs354

sysfs355

Adding and Removing kobjects from sysfs357

Adding Files to sysfs358

Default Attributes358

Creating New Attributes359

Destroying Attributes360

sysfs Conventions360

The Kernel Events Layer361

Conclusion362

18 Debugging363

Getting Started363

Bugs in the Kernel364

Debugging by Printing364

Robustness365

Loglevels365

The Log Buffer366

syslogd and klogd367

Transposing printf () and printk ()367

Oops367

ksymoops369

kallsyms369

Kernel Debugging Options370

Asserting Bugs and Dumping Information370

Magic SysRq Key371

The Saga of a Kernel Debugger372

gdb372

kgdb373

Poking and Probing the System373

Using UID as a Conditional373

Using Condition Variables374

Using Statistics374

Rate and Occurrence Limiting Your Debugging375

Binary Searching to Find the Culprit Change376

Binary Searching with Git376

When All Else Fails: The Community377

Conclusion378

19 Portability379

Portable Operating Systems379

History of Portability in Linux380

Word Size and Data Types381

Opaque Types384

Special Types384

Explicitly Sized Types385

Signedness of Chars386

Data Alignment386

Avoiding Alignment Issues387

Alignment of Nonstandard Types387

Structure Padding387

Byte Order389

Time391

Page Size391

Processor Ordering392

SMP Kernel Preemption, and High Memory393

Conclusion393

20 Patches, Hacking, and the Community395

The Community395

Linux Coding Style396

Indention396

Switch Statements396

Spacing397

Braces398

Line Length399

Naming400

Functions400

Comments400

Typedefs401

Use Existing Routines402

Minimize if defs in the Source402

Structure Initializers402

Fixing Up Code Ex Post Facto403

Chain of Command403

Submitting Bug Reports403

Patches404

Generating Patches404

Generating Patches with Git405

Submitting Patches406

Conclusion406

Bibliography407

Index411

热门推荐