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

  • Home
  • SEARCH
  • 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 8810413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:06:50+00:00 2026-06-14T03:06:50+00:00

I have for project to code a virus scanner by using clamAV signature database.

  • 0

I have for project to code a virus scanner by using clamAV signature database.
For increasing speed I use threads. (combo & and wait)
How my code works:

It read all files in a folder and sub-folders

function recursive_files()
{
files=$(find $folder_path -type f)
for f in $files
do
    raw_and_scan "$f" &
done
wait
}

As you can see, for each file there is a thread.

function raw_and_scan()
{
raw_test_file $1
read_signature_db_by_line $1
}

Read_signature.. read each line of signature database

    function  read_signature_db_by_line()
    {
    cat $signature_path | (while read LINE ; do
        stringtokenizer_line_db $LINE $1 $raw_file &
    done
    wait
    )  }

As you can see, for each line of DB there is a thread.

I did the double thread implementation because I saw a huge performance (using time benchmark)

When I scan 50 files with 50 lines into the DB. It works fine.

But when I scan my home folder (800 files) it doesn’t work and worse I have got a warning(cant fork() anymore) and my computer freeze, It needs to reboot.

I watch the process (htop) until 5000 tasks it works.

You can file my poject https://github.com/peondusud/Bash.antivir

At the end, I would to scan folder with a database 65000 lines.

If you have any idea to limit threads or something like that.

Thanks.

  • 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-14T03:06:51+00:00Added an answer on June 14, 2026 at 3:06 am

    The fact you see a huge improvement going from a single process (not thread) into two does not mean you will go super fast using 5000 processes! Actually it is the opposite- if you plan to have processes doing intensive work you should limit it to 2* number of cpu cores in your system (this is a generic rule of thumb)

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

Sidebar

Related Questions

I have a little private Google code project. For a SCM I use Mercurial.
I have MVC3 project & Valums file uploader . The code is following <script
I have a very basic C++ project in code blocks that makes use of
I have a project with a structure like this: project code art config Art
I have a Maven project with JavaScript code. There is a special javascript compiler
I have a project in Java and I need to make a code listing
I have a project where we are trying to get the code space down.
I have one project inside that I have SqlServerFunctions in test.cs file. code: [Microsoft.SqlServer.Server.SqlFunction]
So in Code::Blocks in Ubuntu (latest). I have a project in which I load
i have a code generator project i would like to offer like open source,

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.