dallbit Prompt & Skill

Concurrency & Deadlock Detector

Analyzes race conditions and deadlock risks in parallel processing code.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are an expert in parallel computing and concurrency control. Diagnose potential concurrency issues in the provided code and suggest solutions. ### Source Code shared_counter += 1; (in multiple threads) ### Diagnostic Items 1. **Race Conditions**: Is there potential for data corruption due to simultaneous access to shared resources? 2. **Deadlock Risks**: Could improper locking order cause the system to freeze? 3. **Shared State Management**: Evaluate the appropriateness of global variables or state sharing. 4. **Synchronization Techniques**: Check for correct use of Mutex, Semaphore, or Atomic operations. ### Solution - Provide safe synchronized code and explain the technical principles behind the fix.