keyboard_arrow_up
Analysis of Synchronization Mechanisms in Operating Systems

Authors

Oluwatoyin Kode and Temitope Oyemade, Bowie State University, Maryland, USA

Abstract

This research analyzed the performance and consistency of four synchronization mechanisms—reentrant locks, semaphores, synchronized methods, and synchronized blocks—across three operating systems: macOS, Windows, and Linux. Synchronization ensures that concurrent processes or threads access shared resources safely, and efficient synchronization is vital for maintaining system performance and reliability. The study aimed to identify the synchronization mechanism that balances efficiency, measured by execution time, and consistency, assessed by variance and standard deviation, across platforms.The initial hypothesis proposed that mutex-based mechanisms, specifically synchronized methods and blocks, would be the most efficient due to their simplicity. However, empirical results showed that reentrant locks had the lowest average execution time (14.67ms), making them the most efficient mechanism, but with the highest variability (standard deviation of 1.15). In contrast, synchronized methods, blocks, and semaphores exhibited higher average execution times (16.33ms for methods, 16.67ms for blocks), but with greater consistency (variance of 0.33).The findings indicated that while reentrant locks were faster, they were more platform-dependent, whereas mutex-based mechanisms provided more predictable performance across all operating systems. The use of virtual machines for Windows and Linux was a limitation, potentially affecting the results. Future research should include native testing and explore additional synchronization mechanisms and higher concurrency levels. These insights help developers and system designers optimize synchronization strategies for either performance or stability, depending on the application's requirements.

Keywords

Synchronization mechanisms, Semaphores, Reeentrant lock, Synchronization block, Synchronization method, Mutual Exclusions (Mutex), Concurrency, Operating Systems.