Multi-threading Performance

# Task Performance vs. Concurrency

Line chart showing the breakdown of task completion time for each metric, including the performance gain.

## Data Analysis

The data was extracted from the provided `multi-threading.txt` file. The system's CPU has 6 physical cores but 12 logical CPUs, thanks to Hyper-Threading technology.

As the number of concurrent processes increases from 1 to 6, the task completion time decreases significantly as each process gets a dedicated physical core. The performance gain continues between 6 and 9 processes because the system starts using the second logical thread on each core, utilizing idle resources to improve efficiency.

Beyond 12 concurrent processes, the performance gains diminish, and the time can even slightly increase. This is likely due to the overhead of the operating system needing to manage and switch between more processes than there are logical cores.

## Understanding the Time Metrics

- Real Time: This is the total elapsed time from start to finish, including time spent waiting for other processes or I/O. It's the "wall-clock" time you would measure with a stopwatch.
- User Time: This is the amount of time the CPU spent executing the user's code. It reflects the time spent on the actual computations of your program.
- System Time: This is the amount of time the CPU spent on system-level tasks on behalf of your program, such as interacting with the operating system kernel, handling I/O, or managing memory.

In a multi-threaded application, the sum of user time and system time can be greater than the real time because multiple cores are working in parallel.