Documentation/percpu-rw-semaphore.txt

Chinese translated version of Documentation/percpu-rw-semaphore.txt

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Chinese maintainer: 秦芹 18768122412@163.com
---------------------------------------------------------------------
Documentation/percpu-rw-semaphore.txt的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。

中文版维护者: 秦芹 18768122412@163.com
中文版翻译者:秦芹 18768122412@163.com

以下为正文

---------------------------------------------------------------------

 Percpu rw semaphores
 Percpu rw信号量
  --------------------
  
  Percpu rw semaphores is a new read-write semaphore design that is
  optimized for locking for reading.
  Percpu rw信号量是一个为优化锁定阅读的新读写信号量。
  The problem with traditional read-write semaphores is that when multiple
  cores take the lock for reading, the cache line containing the semaphore
  is bouncing between L1 caches of the cores, causing performance
  degradation.
  该信号灯与传统的读写信号相比,存在的问题是,当多个内核占据阅读锁时,

  包含信号量的高速缓存线在内核的L1高速缓存之间进行反弹,从而引起性能降低。
  Locking for reading is very fast, it uses RCU and it avoids any atomic
  instruction in the lock and unlock path. On the other hand, locking for
  writing is very expensive, it calls synchronize_rcu() that can take
  hundreds of milliseconds.
  读锁是非常快的,它使用RCU,从而避免了任何锁定和非锁定路径的原子指令。

  另一方面,写锁是非常昂贵的,它调用synchronize_rcu()函数需消耗几百毫秒的时间。
  The lock is declared with "struct percpu_rw_semaphore" type.
  The lock is initialized percpu_init_rwsem, it returns 0 on success and
  -ENOMEM on allocation failure.
  The lock must be freed with percpu_free_rwsem to avoid memory leak.
  锁被声明为“struct percpu_rw_semaphore”类型。
  用percpu_init_rwsem初始化锁,如果初始化成功,则返回0,否则-ENOMEM分配失败。
  为了避免内存泄露,必须用percpu_free_rwsem来释放锁。
  The lock is locked for read with percpu_down_read, percpu_up_read and
  for write with percpu_down_write, percpu_up_write.
  锁被锁定主要有两种,一种是通过percpu_down_read, percpu_up_read来锁定读锁,
  另一种是通过percpu_down_write, percpu_up_write来控制写锁。
  The idea of using RCU for optimized rw-lock was introduced by
  Eric Dumazet <eric.dumazet@gmail.com>.
  The code was written by Mikulas Patocka <mpatocka@redhat.com>
  使用RCU优化rw-lock的想法是Eric Dumazet(<eric.dumazet@gmail.com>)提出的。
  代码是通过Mikulas Patocka(<mpatocka@redhat.com>)书写的。


将QT += core QT -= gui CONFIG += c++11 TARGET = UavRectifyLoadLIb CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS win32{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../../RasterManager/bin/Debug } else{ DESTDIR = $$PWD/../../../../RasterManager/bin/release } INCLUDEPATH += $$PWD/../../../include/gdal1101 DEPENDPATH += $$PWD/../../../include/gdal1101 } else{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../product/release32 } else{ DESTDIR = $$PWD/../../../product/release32 } } # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lUAVAutoRectifyMt -lUAVAutoRectify -lUAVAutoRectifyFi INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_core unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_imgproc INCLUDEPATH += $$PWD/../../../lib/opencvf249 DEPENDPATH += $$PWD/../../../lib/opencvf249 unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_core #unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgproc unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_features2d unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgcodecs INCLUDEPATH += $$PWD/../../../../../../../usr/local/include DEPENDPATH += $$PWD/../../../../../../../usr/local/include unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lDEMDriver unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lProjection unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lIImage_gC QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO 转为cmake格式
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值