CogitativeJacob / GroupProjectOS

0 stars 0 forks source link

Project Architecture Document for Synchronized Banking System

Architectural Overview

The Synchronized Banking System is designed to manage banking transactions in a concurrent environment, leveraging the power of process-based parallelism and synchronization techniques in C. The system focuses on ensuring data consistency and integrity through controlled access to shared resources, such as transaction logs.

Component Design

Shared Memory (shared_memory.h & shared_memory.c)

Purpose: Facilitates inter-process communication (IPC) by providing a shared space for processes to read and write transaction data.

Process Management

Included in: Main driver file (main.c)

Purpose: Manages the lifecycle of child processes that handle individual transactions to leverage parallelism.

Transactions (transactions.h & transactions.c)

Purpose: Defines the structure of transactions and provides functionality to process and log transactions.

Synchronization (synchronization.h & synchronization.c)

Purpose: Ensures that access to shared resources, such as the transaction log file, is synchronized among processes to prevent data corruption and race conditions.

Utility Functions (utils.h)

Purpose: Provides additional helper functions as needed for file operations, error handling, and logging.

Synchronization Strategy

The system utilizes a monitor construct, encapsulated by the MonitorQueue, to control access to shared resources. This strategy prevents race conditions and ensures that only one process at a time can perform operations on the shared resource, thereby maintaining data integrity.

IPC Mechanisms

Inter-process communication is achieved through shared memory, allowing child processes to share transaction data with each other and with the parent process. This mechanism is critical for coordinating actions and sharing status updates among processes.

Conclusion

This architecture provides a robust foundation for building a synchronized banking system capable of handling concurrent transactions safely and efficiently. Future enhancements may include more complex transaction processing logic, enhanced error handling, and expanded synchronization mechanisms to support additional shared resources.