信号量的实际用途是什么? [英] What are the practical uses of semaphores?

查看:593
本文介绍了信号量的实际用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非二进制的..
我从未遇到过需要使用信号量而不是互斥量的问题. 那么,这主要是理论上的构造,还是像Office这样的真正的Firefox,它们有使用它们的地方吗? 如果是这样,信号量的常见用法有哪些?

Nonbinary ones..
I have never encountered a problem that required me to use a semaphore instead of mutex. So is this mostly theoretical construct, or real sw like Office, Firefox have places where they use it? If so what are the common use patterns for semaphores?

推荐答案

我认为您已经知道信号量是什么,而您只是想知道它如何在真实软件"上使用.

I think you already know what a semaphore is and you are just wondering how it is used on "real software".

像Office一样的Firefox,Firefox有使用它们的地方吗?"

是的,真实软件"经常使用信号量,而不仅仅是理论上的,例如铬源,Windows信号灯处理代码

Yes, "real software" use semaphores a lot, it is not just theoretical, e.g. Chromium source, windows semaphore handling code and the same code used by Virtual Box.

信号灯的实际用途是什么"/信号灯的常见使用方式是什么?"

它们更适合于生产者-消费者同步问题.您拥有两者和1的生产者和消费者数量的情况.

They are more suitable for producer-consumer synchronization problems. Situations that you have the number of producers and consumers both > 1.

Fuhrmanator关于信号量的典型用法的参考是好人.

The Fuhrmanator's reference of typical use of semaphores are good ones.

这篇关于信号量的实际用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆