This paper presents a thorough investigation into the performance of various multithreading libraries on different hardware configurations utilizing gem5. The study compares the performance of commonly-used multithreading libraries, including OpenMP, Pthread, TBB, and Dlib, through several benchmarks representing distinct types of workloads. Key hardware factors that directly affect the performance of each library are identified and analyzed. The research findings provide valuable insights and recommendations for selecting an appropriate multithreading library for a given application and hardware platform. Results indicate that the performance of multithreading libraries is influenced by numerous hardware factors, such as L1 cache size, L1 cache associate, L1 cache replacement policy, number of threads, and memory type. The libraries respond differently to these factors, and the performance variability of each library depends on the nature of the workload. The study offers a detailed analysis and valuable insights into the effects of these hardware factors on each library. This study contributes by presenting a comprehensive comparison of several widely used multithreading libraries across numerous hardware configurations, identifying the key hardware factors that influence the performance of each library, and providing insights and recommendations for selecting an appropriate multithreading library for a given application and hardware platform. Ultimately, the study results can help software developers make informed decisions when selecting a multithreading library and optimizing performance for their applications.