<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>System on LeafCxy's Blog</title><link>https://leafcxy.github.io/tags/system/</link><description>Recent content in System on LeafCxy's Blog</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 22 Jul 2025 08:33:47 +0000</lastBuildDate><atom:link href="https://leafcxy.github.io/tags/system/index.xml" rel="self" type="application/rss+xml"/><item><title>什么是线程安全</title><link>https://leafcxy.github.io/posts/2025-07-22-8/</link><pubDate>Tue, 22 Jul 2025 08:33:47 +0000</pubDate><guid>https://leafcxy.github.io/posts/2025-07-22-8/</guid><description>&lt;p&gt;线程安全是多线程编程时的计算机程序代码中的一个概念。&lt;/p&gt;
&lt;!-- more --&gt;
&lt;p&gt;在拥有共享数据的多条线程并行执行的程序中，线程安全的代码会通过同步机制保证各个线程都可以正常且准确的执行，不会出现数据污染等意外情况。&lt;/p&gt;
&lt;p&gt;也就是说，如果我们想要确保在多线程访问的时候，程序还能够按照我们的预期的行为去执行，那么就是线程安全了。同时，线程安全也是一种内存安全，在没有保护机制的情况下，堆内存空间对多线程来说是不安全的地方，因为你放进去的数据，可能被别的线程“破坏”。&lt;/p&gt;</description></item></channel></rss>