How roobeerr13/dekker-1er-intento works
Project type and purpose
• This is a small Python project whose sole script, dekker1.py, implements Dekker’s mutual-exclusion algorithm for two “threads.”
• Its purpose is educational or demonstrative: show how two concurrent tasks coordinate via shared flags and a turn variable to safely enter a critical section.
File structure
• Top level:
• README.md – contains only the project title
• dekker1.py – the Python implementation
• No frontend, backend, database or external dependencies beyond Python’s standard threading library.
README for additional insights
• README only gives the project name ("dekker-1er-intento")
a. Main components
• Thread A (or Process A)
• Thread B (or Process B)
• Shared memory segment containing:
– flagA (Boolean)
– flagB (Boolean)
– turn (enum or int, indicating whose turn it is)
• Critical Section (the code region both threads contend for)
b. Relationships and interactions
• Both threads read/write the shared flags and turn variable.
• A common “entry protocol” before critical section, and “exit protocol” afterward.
c. Architectural patterns and design principles
• Concurrency control / mutual exclusion
• Busy-waiting (spinlock) pattern
• Single shared data store (no message passing)
d. Key technologies/frameworks
• Python threading module (Thread objects)
• Primitive shared variables (no high-level locks)
Diagramming recommendations
• Rectangles for Thread A and Thread B
• Critical section in red or bold to show exclusivity
Details to capture
• Sequence of operations in each thread’s entry protocol (set own flag, busy-wait on other flag and turn)
• The single shared “turn” variable as the tie-breaker
• The critical section’s boundary
• Exit protocol resetting the flag