Access primitives

Access to a resource or to a shared area

Producer-consumer example

Producer

Consumer

Requirements

Requirements that should be observed in accessing a critical section:

  • Effective mutual exclusion – access to the critical sections associated with the same resource, or shared area, can only be allowed to one process at a time, among all processes that compete for access.

  • Independence on the number of intervening processes or on their relative speed of execution.

  • A process outside its critical section cannot prevent another process from entering its own critical section.

  • No starvation – a process requiring access to its critical section should not have to wait indefinitely.

  • Length of stay inside a critical section should be necessarily finite.

Types of solutions

In general, a memory location is used to control access to the critical section.

  • it works as a binary flag.

Two types of solutions: software solutions and hardware solutions.

  • software solutions – solutions that are based on the typical instructions used to access memory location.

    • read and write are done by different instructions.

    • interruption can occur between read and write.

  • hardware solutions – solutions that are based on special instructions to access the memory location.

    • these instructions allow to read and then write a memory location in an atomic (uninterruptible) way.

Last updated