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...

Which instruction is used to step through each element of a list?

a. Do together b. For all in order c. For all together d. loop e. None of these

Computer Science & Information Technology

When you have two identical rules in a style sheet, which rule has a greater chance of formatting the targeted element?

What will be an ideal response?

Computer Science & Information Technology

A quad-core computer uses multiple processors

Indicate whether the statement is true or false

Computer Science & Information Technology

The question "What flavor ice cream would you like?," is an example of ____.

A. multiple branching B. parallel branching C. repetitive branching D. binary branching

Computer Science & Information Technology