This dissertation develops general-purpose hardware mechanisms that address the dual challenges of parallel programming and software reliability. We have devised hardware mechanisms in the memory hierarchy that shed light on the memory system and control the visibility of data between the multiple threads. The key novelty is the use of cache coherence protocols to implement hardware mechanisms that enable software to track and regulate memory accesses at cache-line granularity. We demonstrate that exposing the events in the memory hierarchy provides useful information that was either previously invisible to software or would have required heavyweight instrumentation.
Focusing on the challenge of parallel programming, our mechanisms aid \emph{Transactional Memory} (TM) implementations, a programming construct that seeks to simplify synchronization of shared state. We develop two mechanisms, \textit{Alert-On-Update} (AOU) and \textit{Programmable Data Isolation} (PDI), to accelerate common TM tasks. AOU selectively exposes cache events, including those that are triggered by remote accesses, to software in the form of events. TM runtimes use it to detect accesses that overlap between transactions (i.e., conflicts), and track a transaction's status. \textit{Programmable-Data-Isolation} (PDI) allows multiple threads to temporarily hide their speculative writes from concurrent threads in their private caches until software decides to make them visible. We have used PDI and AOU to implement two TM run-time systems, RTM and FlexTM. Both RTM and FlexTM are flexible runtimes that permit software control of the timing of conflict re\ solution and the policy used for conflict management.
To address the challenge of software reliability, we propose Sentry, a lightweight, flexible access-control mechanism. Sentry allows software to regulate the reads and writes to memory regions at cache-line granularity based on the context in the program. Sentry coordinates the coherence states in a novel manner to eliminate the need for permission checks entirely for a large majority of the program's accesses (all cache hits), thereby improving efficiency. Sentry improves application reliability by regulating data visibility and movement between the multiple software modules present in the application. We use a real-world webserver, Apache, as a case study to illustrate Sentry's capability to guard the core application from vulnerabilities in the application's modules.