DescriptionQ958
Q958DVASIC interview problem
Control a background process lifecycle
TechniquesConcurrencyprocessjoin_none
DifficultyMedium
TopicTemporal Checks
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Start a polling task in the background and later stop exactly that task through a stored process handle.
Example input and output
Use this case to check your interpretationInput
call start(), start(), stop(), stop()Output
one worker starts; second start is ignored; first stop kills that owned worker; final stop is a safe no-opExplanation
Publishing the stored process handle before start returns removes the initialization race and targets only the intended background task.
02
Requirements (3)
- Starting the worker must not leave the caller racing an uninitialized handle.
- Ignore a second start while the worker is already active.
- Stopping must be safe when no worker is active.
