0
0
ARM Architectureknowledge~5 mins

Bus matrix for multi-master access in ARM Architecture - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Bus matrix for multi-master access
O(n)
Understanding Time Complexity

When multiple masters try to access shared resources via a bus matrix, it is important to understand how the time to complete requests grows as more masters or requests increase.

We want to know how the bus matrix handles multiple access requests and how this affects overall execution time.

Scenario Under Consideration

Analyze the time complexity of arbitration and access in a bus matrix for multiple masters.


// Pseudocode for bus matrix arbitration
loop forever {
  for each master in masters {
    if (master has request) {
      grant access to master;
      wait for master to complete transaction;
    }
  }
}
    

This code cycles through each master, granting access one at a time if they have a request, then waits for the transaction to finish before moving on.

Identify Repeating Operations

Identify the loops and repeated checks in the bus matrix arbitration process.

  • Primary operation: Looping through each master to check for requests and grant access.
  • How many times: Once per master per arbitration cycle; repeated continuously as requests come in.
How Execution Grows With Input

As the number of masters increases, the bus matrix must check more requests each cycle, increasing the time to grant access.

Input Size (n = number of masters)Approx. Operations per cycle
1010 checks and possible grants
100100 checks and possible grants
10001000 checks and possible grants

Pattern observation: The number of operations grows linearly with the number of masters.

Final Time Complexity

Time Complexity: O(n)

This means the time to process all masters' requests grows directly in proportion to the number of masters.

Common Mistake

[X] Wrong: "The bus matrix can grant access to all masters at the same time, so time does not increase with more masters."

[OK] Correct: In reality, the bus matrix grants access one master at a time to avoid conflicts, so more masters mean more checks and longer wait times.

Interview Connect

Understanding how bus matrices handle multiple masters helps you think about resource sharing and arbitration in hardware, a useful skill for system design discussions.

Self-Check

"What if the bus matrix could grant access to multiple masters simultaneously? How would the time complexity change?"