【正文】
_inc()。 atomic_add()。 clear_bit()。內(nèi)部公開▲ 第 1頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許,不得外傳 內(nèi)部公開▲ 第 2頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許,不得外傳 Linux同步機(jī)制 李翌 日期: 2022年 11月 22日 內(nèi)部公開▲ 第 3頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許,不得外傳 概述 內(nèi)核同步的類型: ?與中斷的同步 ?多線程的同步 ?SMP ?內(nèi)核搶占 內(nèi)部公開▲ 第 4頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許,不得外傳 概述 原子手段 忙等同步 睡眠同步 復(fù)雜 簡(jiǎn)單 效率低 效率高 atomic lock_int spin_lock mutex read write sem .... 其它同步手段 RCU PerCPU DATA preempt disable 注意:這里的效率高低只是同步手段本身的效率,但是否在實(shí)際中效率高低要根據(jù)使用的上下文環(huán)境具體分析 內(nèi)部公開▲ 第 5頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許,不得外傳 概述 Technique Description Scope PerCPU variables Duplicate a data structure among the CPUs All CPUs Atomic operation Atomic readmodifywrite instruction to a counter All CPUs Memory barrier Avoid instruction reordering Local CPU or All CPUs Spin lock Lock with busy wait All CPUs Semaphore Lock with blocking wait (sleep) All CPUs Seqlocks Lock based on an access counter All CPUs Local interrupt disabling Forbid interrupt handling on a single CPU Local CPU Local softirq disabling Forbid deferrable function handling on a single CPU Local CPU Readcopyupdate (RCU) Lockfree access to shared data structures through pointers All CPUs from ULK III 內(nèi)部公開▲ 第 6頁(yè) 本文中的所有信息歸中興通訊股份有限公司所有,未經(jīng)允許