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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:12:42+00:00 2026-05-26T13:12:42+00:00

I have some processing I want to do on thousands of files simultaneously. Grab

  • 0

I have some processing I want to do on thousands of files simultaneously. Grab the first byte of all the files and do something, go to the next byte, etc. The files could be any size, so loading them all into memory could be prohibitive.

I’m concerned that due to limitations in operating system file descriptors, just naively opening thousands of files and reading them in seems like I might run into issues.

But cycling through and opening/closing files would be rather inefficient, I imagine.

Is there some efficient mechanism to handle what I’m trying to do?

NOTE: this function may be distributed to use machines that I would have no control over, so I can’t just go changing settings on the OS.

  • 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-26T13:12:43+00:00Added an answer on May 26, 2026 at 1:12 pm

    I want to do on thousands of files simultaneously. Grab the first byte of all the files and do something, go to the next byte, etc.

    Are these files small enough that you could read them all into memory at once. If so, then read the files one at a time, then process all the files a byte at a time.

    I’m concerned that due to limitations in operating system file descriptors, just naively opening thousands of files and reading them in seems like I might run into issues.

    You might. The only way to find out is to try.

    But cycling through and opening/closing files would be rather inefficient, I imagine.

    Yes it would. But if you can’t read all the files into memory, and your operating system can’t open thousands of files at a time, then this is your last resort.

    What you can do is find out the limit of simultaneous open files that your system can handle. Let’s just say for the sake of discussion that your system can open 100 files at a time, and you have 2,500 files to process.

    Then your process would look something like this.

    • Open the first 100 files.
    • Write an output file that contains the first byte from the 100 files, then the second byte from the 100 files, and so on.
    • Handle any problems you might encounter if the 100 files are not of the same byte length.

    Now, after running this process through all your files, you’ll have 25 intermediate files.

    Then your second process would look something like this.

    • Open the 25 intermediate files.
    • Process the first 100 bytes from each file.

    You would determine the actual numbers (simultaneous files open, number of intermediate files) through experimentation or research on your operating system.

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

Sidebar

Related Questions

I have a function (call it Process()) that does some processing. I want to
So I have some cool Image Processing algorithm. I have written it in OCaml.
I have small utility that does some processing on a file and changes the
Scenario I have a windows service written in C# that performs some processing based
We have built a web application that accepts SOAP messages, does some processing, calls
I am processing some CSV file which i have copied in Bin folder of
I have a lingo script which runs some data processing for a Flash movie.
I have a trie which I am using to do some string processing. I
I basically have a unix process running and it is doing some heavy processing
I have some ASP.NET web services which all share a common helper class they

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.