-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotes_ACID_and_Concurrency.txt
More file actions
27 lines (21 loc) · 1.7 KB
/
Notes_ACID_and_Concurrency.txt
File metadata and controls
27 lines (21 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ACID Properties and Concurrency (summary)
========================================
Atomicity
- Financial operations (transfers, loan disbursement, payments) are implemented as single procedures.
- Where multiple file updates are required, the code uses temporary files and renames (atomic replace) to avoid partial writes.
Consistency
- Input validation is applied before any transaction (balances, account existence, etc).
- CSV format expectations are enforced by parsers; malformed lines are skipped with logging.
Isolation
- File-level locking is used when updating shared CSV files to prevent race conditions.
- The project uses POSIX file locks (flock or fcntl) in utils/session_manager functions to ensure that concurrent processes do not interleave writes.
Durability
- After successful operations, data is flushed to disk using fsync or file close semantics to ensure the OS writes are committed.
- The project keeps transactions.csv as the audit trail for recovery.
Concurrency & Synchronization
- The codebase contains helper functions (in utils.c / session_manager.c) for acquiring and releasing locks around critical sections when accessing data files.
- For multi-step operations, locks are held for the minimum required time and released promptly.
- The design favors fail-safe behavior: if an operation cannot acquire the lock, it either retries or returns an error to the caller for retry.
Notes & Caveats
- The above describes standard approaches; please review the relevant functions in utils.c and session_manager.c for exact implementations and any platform-specific behavior.
- If you require a formal proof or instrumentation logs demonstrating concurrency under load, I can run tests and add them to the package.