← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Defend an Architecture

Choose How to Share a Buffer

L2 Mid-LevelL4 Staffdefend an architecture

The Question

The interviewer asks

Two cores will exchange a buffer on a new chip. What would you measure before choosing how they share it?

Reveal the Model Answer

The ap_soc chip has one hart and no data cache. S9.3 and S9.9 model cached systems. Measure which lines each participant changes, how often ownership moves and when the reader needs the result. Both designs need a rule for publishing completed data.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Mid-Level)

Tie the choice to the access pattern.

Choose Your Follow-up

I’ve answered the opening question

Choose the route closest to your reasoning. Answer the follow-up aloud, then open the closing question.

I chose coherent sharing.

Each core writes its own counter. Why does moving one counter to a different cache line reduce traffic?

Reveal the Model Answer

Writing either counter requires ownership of its whole line. Alternating writers on one line repeatedly take ownership from each other. The false sharing run reports “bus commands=4 flushes=3”. Separate lines need one bus command in the comparison.

Self-Check

Tick each key point you covered in your answer.

Choose How the Engine Reads the Buffer

The engine can use a coherent port or software can clean and invalidate lines. Which wins for a 16-word buffer?

Reveal the Model Answer

In the S9.9 model, four dirty lines cost 38 cycles with cleaning and 33 through the port. One dirty line costs 26 against 33. Cleaning wins with at most two dirty lines. On that path, wait for completion and invalidate the result before reading. These are model results because ap_soc has one hart and no data cache.

Self-Check

Tick each key point you covered in your answer.

I proposed explicit ownership.

Larger batches reduce handoffs, but the oldest sample now waits too long. What would govern your batch size?

Reveal the Model Answer

Size from the peak arrival rate. Bound the oldest sample’s wait for the batch to fill, transfer and finish processing. Send a partial batch when waiting for another sample would miss its deadline.

Self-Check

Tick each key point you covered in your answer.

Choose How the Engine Reads the Buffer

The engine can use a coherent port or software can clean and invalidate lines. Which wins for a 16-word buffer?

Reveal the Model Answer

In the S9.9 model, four dirty lines cost 38 cycles with cleaning and 33 through the port. One dirty line costs 26 against 33. Cleaning wins with at most two dirty lines. On that path, wait for completion and invalidate the result before reading. These are model results because ap_soc has one hart and no data cache.

Self-Check

Tick each key point you covered in your answer.

I focused on safe publication.

In the mailbox example, which store must become visible before the producer wakes the reader?

Reveal the Model Answer

Publish the payload first, then raise the wake request. With RAISE_FIRST the second hart reads zero at e5. The mailbox store arrives at e10. Return ownership only when the reader finishes using the buffer.

Self-Check

Tick each key point you covered in your answer.

Choose How the Engine Reads the Buffer

The engine can use a coherent port or software can clean and invalidate lines. Which wins for a 16-word buffer?

Reveal the Model Answer

In the S9.9 model, four dirty lines cost 38 cycles with cleaning and 33 through the port. One dirty line costs 26 against 33. Cleaning wins with at most two dirty lines. On that path, wait for completion and invalidate the result before reading. These are model results because ap_soc has one hart and no data cache.

Self-Check

Tick each key point you covered in your answer.

I proposed tracking exclusive ownership.

S9.3’s four-state run starts “A=E B=I mem=0000”. A writes 55. Who has the current value, and what if B now reads and then writes?

Reveal the Model Answer

Only A held the clean copy, so its write changes E to M silently. The row gives “bus=-” and memory still holds 0000. For B’s read, the quiz records “s4 B read got=0055 bus=read-miss from=A wb=A A=S B=S mem=0055”. In a separate run B writes from S by invalidating A: “s3 B write x=11 bus=invalidate … A=I B=M”.

Self-Check

Tick each key point you covered in your answer.

Choose How the Engine Reads the Buffer

The engine can use a coherent port or software can clean and invalidate lines. Which wins for a 16-word buffer?

Reveal the Model Answer

In the S9.9 model, four dirty lines cost 38 cycles with cleaning and 33 through the port. One dirty line costs 26 against 33. Cleaning wins with at most two dirty lines. On that path, wait for completion and invalidate the result before reading. These are model results because ap_soc has one hart and no data cache.

Self-Check

Tick each key point you covered in your answer.

I counted the saved invalidate.

What must the system learn on A’s read miss before granting E instead of S?

Reveal the Model Answer

Every other cache must say whether it holds the block. Only when no other cache has a copy can A later write silently. A shared level can keep track of holders to direct those checks.

Self-Check

Tick each key point you covered in your answer.

Choose How the Engine Reads the Buffer

The engine can use a coherent port or software can clean and invalidate lines. Which wins for a 16-word buffer?

Reveal the Model Answer

In the S9.9 model, four dirty lines cost 38 cycles with cleaning and 33 through the port. One dirty line costs 26 against 33. Cleaning wins with at most two dirty lines. On that path, wait for completion and invalidate the result before reading. These are model results because ap_soc has one hart and no data cache.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Misconception

Coherence tells the reader when the buffer is ready.

A reader can observe a partially constructed object even in a coherent system.

Source S9.1, mailbox publication order.

Buzzword Without Mechanism

Zero copy is always fastest.

Sharing a cache line across frequent writes can consume time and interconnect bandwidth.

Learn It, Then Prove It