Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:20:48+00:00 2026-06-04T00:20:48+00:00

I have following code for opening all files: int ret= open(zFile, flags, mode); posix_fadvise

  • 0

I have following code for opening all files:

int ret= open(zFile, flags, mode);
posix_fadvise (ret, 0, 0, POSIX_FADV_RANDOM);

and posix_fadvise return 0 means success.

But it is not working correctly.

OS: Ubuntu 12.04

Strace is showing that the read done by the program is
29088 bytes.

I used following command to calculate read from strace log

cat fadvise3.log | grep read | awk '{SUM+=$NF} END {print SUM}'

But iotop is showing that program has read about 2.5 MB.

  1. Is there a way I can know why it is reading that much ?
  2. Why iotop O/p is not matching with strace?
  3. Why posix_fadvise (ret, 0, 0, POSIX_FADV_RANDOM); is not working?
  4. How can I disable read ahead for a process?

More details about read:
I am using sqlite library. and modified their function posixOpen to open a database. Read is done by sqlite.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:20:49+00:00Added an answer on June 4, 2026 at 12:20 am

    Disk read are done in disk block, this is a hardware limit, POSIX_FADV_RANDOM can’t change that. If you read less then a block, you still have to pay the cost of that block.

    Even so, posix_fadvise, as its name suggest, is just an advise to the kernel. A hint. Not a strict rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code for opening files programatically: Uri path = Uri.fromFile(file); Intent intent
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have the following code in the javscript to open a confirmation dialog with
I have a text file which all contain the following fragments of code in
I have following code: <div class='parent'> <div class='left-child'></div> <div class=right-child></div> </div> What I want
I have following code snippet and i am trying to evaluate the time take
I have following Code Block Which I tried to optimize in the Optimized section
I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My
I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.