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 4616276
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:57:31+00:00 2026-05-22T01:57:31+00:00

I am working on my small c++ framework and have a file class which

  • 0

I am working on my small c++ framework and have a file class which should also support async reading and writing. The only solution other than using synchronous file i/o inside some worker threads I found is aio. Anyways I was looking around and read somewhere, that in Linux, aio is not even implemented in the kernel but rather with user threads. Is the same true for OSX? Another concern is aio’s functionality of callbacks which has to spawn an extra thread for each callback since you can’t assign a certain thread or threadpool to take care of that (signals are not an option for me). So here are the questions resulting from that:

  • Is aio implemented in the Kernel of osx and thus is most likely better than my own threaded implementation?

  • Can the callback system -spawning a thread for each callback- become a bottleneck in practice?

  • If aio is not worth using on osx, are there any other alternatives on unix? in cocoa? in carbon?

  • Or should I simply emulate async i/o with my own threadpool?

What is your experience on the subject?

  • 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-05-22T01:57:32+00:00Added an answer on May 22, 2026 at 1:57 am

    You can see exactly how AIO is implemented on OSX right here.

    The implementation uses kernel threads, one queue of jobs which each thread pops and execute in a blocking fashion in a priority queue based on each request’s priority (at least that’s what it looks like at a first glance).

    You can configure the number of threads and the size of the queue with sysctl. To see these options and the default values, run sysctl -a | grep aio

    kern.aiomax = 90
    kern.aioprocmax = 16
    kern.aiothreads = 4
    

    In my experience, in order for it to make any sense to use AIO, these limits need to be a lot higher.

    As for the callbacks in threads, I don’t believe Mac OS X supports that. It only does completion notifications through signals (see source).

    You could probably do as good of a job in your own thread pool. One thing you could do better than the current darwin implementation is to sort your read jobs by physical location on the disk (see fcntl and F_LOG2PHYS) which might even give you an edge.

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

Sidebar

Related Questions

I am working on a small MVC framework, which will simply provide a more
I'm working on yet another framework for PHP, and have run into a small
I've been quite used to working on small projects which I coded with 1,000
I'm working on a small bugtracking system which shows a list of bugs. For
I'm working on a small MVC framework (it's really very small) in Scala. I'd
I've been working writing fairly small applications and doing some maintenance work for some
I am a beginner working with Zend Framework, and currently having a small problem:
I'm working on an application which walks through every file in some directories and
We have service that's working with small to large sets of data (document generation),
I'm working on a small templating engine, and I'm using DOMDocument to parse the

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.