> For the complete documentation index, see [llms.txt](https://tuonioooo-notebook.gitbook.io/java-concurrent/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tuonioooo-notebook.gitbook.io/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu.md).

# Java多线程基础

## 目录

* [线程简介](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/11-xian-cheng-jian-jie.md)
* [启动和终止线程](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/qi-dong-he-zhong-zhi-xian-cheng.md)
* [多线程实现方式](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/1duo-xian-cheng-shi-xian-fang-shi.md)
* [多线程环境下，局部变量和全局变量都会共享吗？](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/duo-xian-cheng-huan-jing-xia-ff0c-ju-bu-bian-liang-he-quan-ju-bian-liang-du-hui-gong-xiang-ma-ff1f.md)
* [Java线程间的协助和通信](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/javaxian-cheng-zhi-jian-de-tong-xin.md)
* [实战应用](/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu/shi-zhan-ying-yong.md)

Java从诞生开始就明智地选择了内置对多线程的支持，这使得Java语言相比同一时期的其他语言具有明显的优势。线程作为操作系统调度的最小单元，多个线程能够同时执行，这将显著提升程序性能，在多核环境中表现得更加明显。但是，过多地创建线程和对线程的不当管理也容易造成问题。本章将着重介绍Java并发编程的基础知识，从启动一个线程到线程间不同的通信方式，最后通过简单的线程池示例以及应用（简单的Web服务器）来串联本章所介绍的内容。


---

# 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://tuonioooo-notebook.gitbook.io/java-concurrent/di-yi-7ae0-java-duo-xian-cheng-ji-chu.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.
