Skip to content

Parallelize File Processing - #80

Merged
kilo52 merged 32 commits into
masterfrom
feature/parallelization
Sep 19, 2026
Merged

kilo52 merged 32 commits into
masterfrom
feature/parallelization

Conversation

@kilo52

@kilo52 kilo52 commented Sep 6, 2026

Copy link
Copy Markdown
Member

Adds parallelization capabilities.

Adds support for multi-threading in the main file processing loop of rcnCount().

Adds boolean useMultiThreading member flag to RcnStatOptions type to allow API users to set whether multi-threading should be enabled or disabled.

Adds --no-parallelization CLI option to scount to disable multi-threading on demand.
By default, scount uses multi-threading as basically all workstations these days have multiple cores. This will improve performance for the end user by default.

Threading on GNU/Linux uses pthreads while on Windows we use the standard CreateThread() from the Windows API. Implementations that are not cross-platform are placed into the corresponding platform-specific directories.

Adds Slice type to bind start and end index for an array into one data structure.

Added support for multi-threading in the main file processing
loop of rcnCount().

Added boolean useMultiThreading member flag to RcnStatOptions type
to allow API users to set whether MT should be enabled or disabled.

Added Slice type to bind start and end index for an array
into one data structure.

Added --no-parallelization CLI option to scount to disable MT on demand.
By default, MT is enabled for scount.

The threading-related functions are put in the new internal threading.h header.
The accompanying threading.c implement all cross-platform threading-related
capabilities. For platform-dependent threading code, the platform-specific
threading.c files are added, containing native code for GNU/Linux with pthreads
and Win32 with the standard Windows API using CreateThread().

[CL]: Added parallelization capabilities. [Issue#9]

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Fixed compilation errors.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
@kilo52 kilo52 self-assigned this Sep 6, 2026
@kilo52 kilo52 added the Feature New feature label Sep 6, 2026
@kilo52 kilo52 linked an issue Sep 6, 2026 that may be closed by this pull request
@kilo52 kilo52 added the Performance Significantly affects the performance label Sep 6, 2026
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…c_bool.

Using atomic type instead of manually locking and unlocking on an initialized
mutex for improved performance.
The mutex and its init deinit are kept around, even though not used anymore.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Non-locking atomics are supported by the MS implementation.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Fixed wrong member variable name.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…coverage enabled.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…ctions.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Changed to use LPCRITICAL_SECTION instead of CRITICAL_SECTION pointer.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…ild.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Added cast to LPTHREAD_START_ROUTINE for lpStartAddress
argument in call to CreateThread().

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…ntrol.mutex to NULL.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Reverted commit cb3dd46

Reason: Readability was actually worse, might be confusing to deinit an object
where init failed, even though it is safe in this context.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Changed to use if-statement instead of weird switch-case.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Changed to provide richer error information.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Added debug assertions for WaitForSingleObject() and CloseHandle()
return status values.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
…nction.

Doesn't test much, so removed.

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
@kilo52 kilo52 added the Improvement Improvement of an existing feature label Sep 18, 2026
@kilo52
kilo52 merged commit 59ae242 into master Sep 19, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Improvement Improvement of an existing feature Performance Significantly affects the performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Parallelization Capabilities

1 participant