A thread-safe spreadsheet system developed in C# and .NET, designed to support multiple users performing spreadsheet operations concurrently.
The project focuses on synchronization, fine-grained locking, safe concurrent access, and shared-memory programming.
- Thread-safe two-dimensional spreadsheet
- Fine-grained locking with one
ReaderWriterLockSlimper cell - Separate structure-level synchronization
- Optional concurrent-search limiting with
SemaphoreSlim - Concurrent read and write operations
- Row and column exchange
- Dynamic row and column insertion
- Full-sheet and range-based searching
- Find and replace operations
- Save and load support
- Multi-threaded user simulator
- Windows Forms graphical interface
concurrent-spreadsheet-system/
├── Spreadsheet.Core/
│ ├── SharableSpreadSheet.cs
│ └── Spreadsheet.Core.csproj
│
├── Simulator/
│ ├── Program.cs
│ └── Simulator.csproj
│
├── SpreadsheetApp/
│ ├── Program.cs
│ ├── MainForm.cs
│ └── SpreadsheetApp.csproj
│
└── ConcurrentSpreadsheet.slnx
The solution contains three projects:
Spreadsheet.Core— shared thread-safe spreadsheet implementation.Simulator— multi-threaded console simulation.SpreadsheetApp— Windows Forms graphical application.
The core module contains the SharableSpreadSheet implementation.
Each spreadsheet cell is protected by its own ReaderWriterLockSlim, allowing independent cells to be accessed concurrently.
A separate ReaderWriterLockSlim protects structural changes such as resizing or replacing the spreadsheet arrays.
An optional SemaphoreSlim limits the number of concurrent search operations.
The simulator represents multiple users accessing the same spreadsheet concurrently.
Each user runs on a separate thread and performs randomized operations such as:
- Reading and writing cells
- Searching cells and ranges
- Find and replace
- Exchanging rows and columns
- Adding rows and columns
A Windows Forms desktop application using DataGridView.
The interface supports:
- Editing spreadsheet cells
- Loading saved spreadsheets
- Saving spreadsheets
- Refreshing displayed data
- Filling the spreadsheet with sample data
- C#
- .NET 8
- Windows Forms
- Multithreading
ReaderWriterLockSlimSemaphoreSlim
dotnet build ConcurrentSpreadsheet.slnxdotnet run --project Simulator/Simulator.csproj -- <rows> <cols> <threads> <operations> <sleep-ms>Example:
dotnet run --project Simulator/Simulator.csproj -- 5 5 4 15 10The graphical application uses Windows Forms and is intended to run on Windows.
dotnet run --project SpreadsheetApp/SpreadsheetApp.csproj SharableSpreadSheet
│
┌─────────────┴─────────────┐
│ │
Structure Lock Cell Locks
ReaderWriterLockSlim ReaderWriterLockSlim[,]
│ │
rows / cols / arrays Individual cells
│
└──── Optional SemaphoreSlim
for search limiting
The fine-grained synchronization design allows multiple threads to access independent cells concurrently while maintaining safe access during structural changes.
Siraj Hoshan
Information Systems Engineering Student
Ben-Gurion University of the Negev