User Space中需要Memory Barrier吗?

middle 2006-07-21 07:49:58
Kernel Space在SMP环境下是需要memory barrier的。那么普通的应用程序开发(user space)如果是多线程的话,是否也需要memory barrier?
...全文
320 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
middle 2006-07-26
  • 打赏
  • 举报
回复
经过了几天的搜索,我终于明白了这个问题——从网上找到的答案。答案用一句话来说就是:“在memory barrier的问题上,user space和kernel space没有任何区别。”
按照我自己粗浅的看法,大家可能把user space和kernel space的区别无原则的夸大了。比如想当然的认为user space就不用考虑memory barrier。

那么为什么我们一般在user space不会遇到memory access reording的问题呢——原因在于我们在application development中往往不像kernel这样重视效率,因而经常超过必要限度的使用lock——在application development中,数据完整性往往超过对性能的要求。而lock implies memory barrier。

那么我从网上找到的答案是什么呢?——用“double-check locking”在google上搜索一下,大家就会看到。不光C这样的开发需要考虑memory barrier,就连Java开发也必须在考虑——只要你希望最大限度的提高性能。
middle 2006-07-21
  • 打赏
  • 举报
回复
“同一个进程的多个线程是会被安排在同一个CPU上的”——没有这种assumption吧?

1. 我在Linux scheduler的代码和介绍sechduler的资料里从来没有看到过。
2. 从道理上说也不合理。如果一个due-processor系统上只有10来个process,其中一个process开了30个threads,难道一个processor上永远跑30个threads?
  • 打赏
  • 举报
回复
应该不用吧。即使是SMP的,同一个进程的多个线程是会被安排在同一个CPU上的
Contents Preface i 1 Introduction 1 1.1 Information isBits inContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Programs areTranslated byOtherPrograms intoDifferent Forms . . . . . . . . . . . . . . . 3 1.3 ItPays toUnderstandHowCompilation SystemsWork . . . . . . . . . . . . . . . . . . . . 4 1.4 Processors Read and Interpret Instructions Stored in Memory . . . . . . . . . . . . . . . . . 5 1.4.1 HardwareOrganization of aSystem . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4.2 Running the helloProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5 CachesMatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.6 StorageDevicesFormaHierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.7 TheOperating SystemManages theHardware . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.7.1 Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.7.2 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.7.3 Virtual Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.7.4 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.8 SystemsCommunicateWithOtherSystemsUsingNetworks . . . . . . . . . . . . . . . . . 16 1.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 I Program Structure and Execution 19 2 Representing and Manipulating Information 21 2.1 Information Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.1.1 HexadecimalNotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.1.2 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3 4 CONTENTS 2.1.3 DataSizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.1.4 Addres
MSR Identity Toolbox: A Matlab Toolbox for Speaker Recognition Research Version 1.0 Seyed Omid Sadjadi, Malcolm Slaney, and Larry Heck Microsoft Research, Conversational Systems Research Center (CSRC) s.omid.sadjadi@gmail.com, {mslaney,larry.heck}@microsoft.com This report serves as a user manual for the tools available in the Microsoft Research (MSR) Identity Toolbox. This toolbox contains a collection of Matlab tools and routines that can be used for research and development in speaker recognition. It provides researchers with a test bed for developing new front-end and back-end techniques, allowing replicable evaluation of new advancements. It will also help newcomers in the field by lowering the “barrier to entry”, enabling them to quickly build baseline systems for their experiments. Although the focus of this toolbox is on speaker recognition, it can also be used for other speech related applications such as language, dialect and accent identification. In recent years, the design of robust and effective speaker recognition algorithms has attracted significant research effort from academic and commercial institutions. Speaker recognition has evolved substantially over the past 40 years; from discrete vector quantization (VQ) based systems to adapted Gaussian mixture model (GMM) solutions, and more recently to factor analysis based Eigenvoice (i-vector) frameworks. The Identity Toolbox provides tools that implement both the conventional GMM-UBM and state-of-the-art i-vector based speaker recognition strategies. A speaker recognition system includes two primary components: a front-end and a back-end. The front-end transforms acoustic waveforms into more compact and less redundant representations called acoustic features. Cepstral features are most often used for speaker recognition. It is practical to only retain the high signal-to-noise ratio (SNR) regions of the waveform, therefore there is also a need for a speech activity detector (SAD) in the fr

4,468

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧