当文件加载到内存中 - 为FREAD,的fopen和fwrite电话? [英] When is the file loaded into memory - for fread, fopen and fwrite calls?

查看:125
本文介绍了当文件加载到内存中 - 为FREAD,的fopen和fwrite电话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我做的fopen再FREAD,当是文件实际上/部分加载到存储器
期间的fopen或FREAD?

When I do a fopen and then a fread, when is the file actually/partially loaded in the memory during fopen or fread?

或者基于文件的大小,然后在时间满载的fopen在它被装载部分
FREAD的?

Or is it partially loaded at fopen based on size of file and then fully loaded at time of fread?

同样,当FWRITE叫什么在操作系统层内部发生?
在文件加载到内存在那个时候,或者页面交换偏偏retriving只是一部分
在内存中的文件?

Similarly what happens internally at the OS level when fwrite is called? Is the file loaded into memory at that time, or a page swap happens retriving just that part of file in memory?

在操作系统级别发生在每个调用什么就在内存中,文件加载?

What happens at the OS level at each of these calls with respect to file loading in memory?

推荐答案


  • fopen()函数只创建一个句柄到文件。

  • FREAD()实际读取文件到内存缓冲区(OS级别的缓冲可能会出现透明的客户端。)

  • 的fwrite()将数据写入到文件中,但其提交到存储可能被延迟(例如,与轴颈的文件系统。)

  • fopen() only creates a handle to the file.
  • fread() actually reads the file into a memory buffer (OS-level buffering may occur transparently to the client.)
  • fwrite() writes data into the file, though its committing to the storage may get delayed (e.g. with journalled filesystem.)
  • 这篇关于当文件加载到内存中 - 为FREAD,的fopen和fwrite电话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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