omparethe read/write and mmap/memcpy versions shown in Figure14.28, but include the time needed to synch the ?le contents to disk. Which approach is faster?

What will be an ideal response?

In the version that uses read and write, we need to call fsync to ensurethat the output ?le is safely stored to disk. In the version that uses mmap and memcpy,weneed to call msync with the MS_SYNC ?ag to ensurethat the modi?ed pages in the mapping arewritten to the output ?le on disk. When making the timing measurements, it’s important to ensurethat the ?le being copied (the source) is not in the page cache. If it is in the page cache, we won’t get a true measurement of the cost to read the ?le from disk. One way to do this is ?ll the page cache with the contents of other ?les so that the pages from the last ?le copies arepushed out of the cache. However,this tends to be nondeterministic, because we don’t know what pages areevicted. Newer versions of Linux support a ?le in/procthat gives privileged users the ability to ?ush the page cache. To write out all dirty pages and then drop all clean pages from the page cache on Linux 3.2.0, we can type





Figure 46 shows the results on Linux 3.2.0, including the

Computer Science & Information Technology

You might also like to view...

The ________ method of depreciation that the value of the asset loses the same amount of value each year of its life

A) accumulated B) double distributing-balance C) declining-balance D) straight-line

Computer Science & Information Technology

To capture sound from a CD, ripping software is used.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology