> For the complete documentation index, see [llms.txt](https://richardweiyang-2.gitbook.io/kernel-exploring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://richardweiyang-2.gitbook.io/kernel-exploring/00-device_model.md).

# 设备模型

内核除了管理内存，其很大一部分工作就是管理设备了。如果大家看一眼代码就可以发现drivers目录驱动的代码量估计占一半以上。

现在我们就来看看内核是如何管理这么庞大数量的设备的，其中有三个比较重要的概念：

* 总线
* 驱动
* 设备

## 总线

第一个我想说的是总线bus，因为接着我们就可以看到总线连接着驱动和设备，是整个设备模型的纽带。

[总线](/kernel-exploring/00-device_model/01-bus.md)

## 驱动

驱动和设备部分前后，先聊聊驱动。

[驱动](/kernel-exploring/00-device_model/02-driver.md)

## 设备

终于要看到设备了。

[设备](/kernel-exploring/00-device_model/03-device.md)

## 如何关联设备和驱动

在上面小节的描述中，我们跳过了一个非常总要的环节，那就是驱动和设备是如何关联到一起的。

[绑定](/kernel-exploring/00-device_model/04-bind.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://richardweiyang-2.gitbook.io/kernel-exploring/00-device_model.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
