加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

unix – 系统V和Posix信号量之间的差异

发布时间:2020-12-15 19:54:58 所属栏目:安全 来源:网络整理
导读:使用System V和Posix信号量之间有什么权衡? 从 O’Reilly: One marked difference between the System V and POSIX semaphore implementations is that in System V you can control how much the semaphore count can be increased or decreased; whereas
使用System V和Posix信号量之间有什么权衡?
从 O’Reilly:
  • One marked difference between the System V and POSIX semaphore
    implementations is that in System V
    you can control how much the semaphore
    count can be increased or decreased;
    whereas in POSIX,the semaphore count
    is increased and decreased by 1.
  • POSIX semaphores do not allow manipulation of semaphore permissions,
    whereas System V semaphores allow you
    to change the permissions of
    semaphores to a subset of the original
    permission.
  • Initialization and creation of semaphores is atomic (from the user’s
    perspective) in POSIX semaphores.
  • From a usage perspective,System V semaphores are clumsy,while POSIX
    semaphores are straight-forward
  • The scalability of POSIX semaphores (using unnamed semaphores) is much
    higher than System V semaphores. In a
    user/client scenario,where each user
    creates her own instances of a server,
    it would be better to use POSIX
    semaphores.
  • System V semaphores,when creating a semaphore object,creates an array of
    semaphores whereas POSIX semaphores
    create just one. Because of this
    feature,semaphore creation (memory
    footprint-wise) is costlier in System
    V semaphores when compared to POSIX
    semaphores.
  • It has been said that POSIX semaphore performance is better than
    System V-based semaphores.
  • POSIX semaphores provide a mechanism for process-wide semaphores rather than system-wide semaphores. So,if a developer forgets to close the semaphore,on process exit the semaphore is cleaned up. In simple terms,POSIX semaphores provide a mechanism for non-persistent semaphores.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读