保证文件操作的顺序(Guarantees of order of the operations on file)
我想知道文件/文件系统上的操作顺序是否有任何保证。
考虑我有一个文件
foo.dat
,我将其更新如下:lseek(fd,pos_a,SEEK_SET); write(fd,data_a,size_a); //< - Operation A lseek(fd,pos_b,SEEK_SET); write(fd,data_b,size_b); //< - Operation B lseek(fd,pos_c,SEEK_SET); write(fd,data_c,size_c); //< - Operation C
这样我在文件A,B,C中进行更新。并且可能发生一些故障 - 软件崩溃或例如电源故障。
是否有任何保证,如果执行的操作是以相同的顺序完成的。
即没有任何东西或“A”或“A和B”或“A和B和C”
但不是像“A和C”或“B”这样的情况。
我知道如果我在A和B之间
fsync(fd)
并在A和C之间fsync(fd)
,但它也保证实际上是在文件系统上。我不太关心数据的松散,而是关注它的一致性。
POSIX标准是否保证不会出现无序执行?
所以:
- 有没有这样的保证?
- 在POSIX平台上?
- 在Windows平台上?
- 如果没有什么保证(除了
fsync
)我可以有?I'd like to know if there any guarantees on the order of the operations on file/file system.
Consider I have a file
foo.dat
and I update it as following:lseek(fd,pos_a,SEEK_SET); write(fd,data_a,size_a); //< - Operation A lseek(fd,pos_b,SEEK_SET); write(fd,data_b,size_b); //< - Operation B lseek(fd,pos_c,SEEK_SET); write(fd,data_c,size_c); //< - Operation C
Such that I do updates in file A, B, C. And some fault may occur - software crash or for example power failure.
Is there any guarantees that the operations if they are executed are done in same order.
i.e. That there would be either nothing or "A" or "A and B" or "A and B and C"
But not situations like "A and C" or "B" only.
I know that if I call between A and B
fsync(fd)
and same between A and C but it also guarantees that is actually on file system.I less care about loose of data but rather about its consistency.
Does POSIX standard guarantees that there will be no out-of-order execution?
So:
- As there any such guarantees?
- On POSIX platform?
- On Windows platform?
- If not what guarantees (besides
fsync
) I can have?
原文:https://stackoverflow.com/questions/7463925
最满意答案
查看本教程,它涵盖了相当好的主题:
Check this tutorial, it covers quite well the subject :
相关问答
更多-
NFC阅读器apache cordova(NFC reader apache cordova)[2023-03-28]
解决了nfc.addTagDiscoveredListener而不是nfc.addNdefListener Solved with nfc.addTagDiscoveredListener instead of nfc.addNdefListener -
我想这是因为你的插件使用得太早了。 由于js是动态加载的,因此设备准备就绪时只能使用插件代码。 如果你这样做,它应该工作: document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { if(navigator.compass) alert("ok"); else alert("not supported..."); ...
-
我不认为Cordova明确说明它兼容哪个操作系统版本,但似乎只要您使用的是IOS 8+,Cordova应该可以工作。 https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html (“要求和支持”部分的第2段) 有关更一般的参考: https : //cordova.apache.org/docs/en/latest/guide/support/ I don't think Cordova explicitly states ...
-
查看本教程,它涵盖了相当好的主题: http://coenraets.org/blog/cordova-phonegap-3-tutorial/ 如何在Ubuntu上安装/运行PhoneGap,分步指南 Check this tutorial, it covers quite well the subject : http://coenraets.org/blog/cordova-phonegap-3-tutorial/ How to install/run PhoneGap on Ubuntu, Step ...
-
是的,您需要使用Mac进行构建和签名并将其上传到商店。 您还需要许多不同苹果设备的应用截图和视频。 iOS模拟器仅在Mac中运行。 您可以在互联网上租用Mac。 我建议,买自己的机器。 如果您的预算有限,可以购买二手mac mini。 你可以尝试WM的机会,但ipad的全高清模拟器非常糟糕。 Yes, you need Mac for build & sign and upload it to store. You will need your app screenshots and videos for ...
-
跨平台移动开发,Apache Cordova [已关闭](Cross-platform mobile development, Apache Cordova [closed])[2023-02-11]
要直接回答你的问题“Icenium如何与Phonegap不同?”,我们发布了一篇博文: Icenium和PhoneGap Build之间有什么区别? 你可能也有兴趣: 什么是Icenium真的吗? To answer directly your question "How is Icenium different from Phonegap?", we've published a blog post: What's the Difference Between Icenium and PhoneGap B ... -
WinJS和Apache cordova(WinJS and Apache cordova)[2020-01-22]
取决于您要实施的内容; 只是流桌面或使用桌面上的应用程序。 流媒体桌面只是简单地拍摄桌面图像并将其作为视频流式传输到浏览器。 要利用可用的应用程序,您需要不同的解决方案。 利用COM自动化(C ++中的函数)用于Excel或Chrome,并通过JavaScript调用它。 这意味着创建插件。 虽然你的意思是插件,你不需要在Excel / Chrome或桌面上安装任何东西,但不,你不能。 应该有一个发送数据/流的组件和另一个接收它的组件。 我希望这可以帮助你前进。 Depending on what you ... -
我找到了根本原因。 问题是,通过使用angular-cli工具,标签
会自动添加。 根据标签文档 ,它为解析所有文档的相对URL提供基础。 对于这种用例,删除基本标记或将其配置为有效值(如 修复问题。 因为我没有使用路由功能(还),所以我觉得更容易删除它或设置一个像 这样的值,它适合更多的平台构建。 I have found the root cause. The problem is ... -
你需要检查以下事项: 确保“screen.png”的路径未设置为“只读”。 确保构建服务使用的帐户具有足够的权限来访问该文件。 (尝试使用管理员帐户运行构建服务) 如果仍然无效,请尝试在构建之前添加一个步骤以检出文件。 同样的问题可以在这里提到: https : //social.msdn.microsoft.com/Forums/vstudio/en-US/81d5e57c-49bd-4487-a198-7930b48412b5/error-building-windows-x64-windows-x86 ...
-
在Apache Cordova应用程序中读取和解析CSV文件[关闭](Reading and Parsing CSV File in Apache Cordova App [closed])[2022-07-24]
用“javascript parse csv”在Google上花了两秒钟来查找: http : //papaparse.com Spent two seconds on Google with "javascript parse csv" to find: http://papaparse.com