Skip to content

losbi/File-Synchronization-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

File Synchronization System (FSS)

Made with C
Platform
Build


📌 TL;DR

A Linux-based file synchronization system implemented in C.
Uses multi-process architecture, pipes, inotify, and low-level file operations to keep directories in sync.
Developed as part of a university systems programming course, demonstrating strong skills in system-level programming, concurrency, and IPC.


🚀 Features

  • Multi-process architecture (fork, exec)
  • Inter-process communication with pipes & signals
  • Real-time directory monitoring using inotify
  • Initial + incremental synchronization across directories
  • Console interface with commands (add, shutdown)
  • Logging system for manager and console
  • Detailed execution & error reports

🛠️ Technologies & Skills Demonstrated

  • C programming (Linux, system-level)
  • Concurrency & Process Management
  • Event-driven programming (inotify, poll)
  • Data structures (linked list for sync state tracking)
  • Low-level file I/O (open, read, write, unlink)
  • Build automation with Makefile

📂 Project Structure

hw/
├── fss_manager/       # Core manager process
│   ├── config_file    # User-defined configuration (required)
│   ├── manager_log    # Manager log file
│   └── ...
├── fss_console/       # Command-line console interface
│   └── console_log    # Console log file
├── worker/            # Worker process handling sync operations
├── Makefile           # Build automation
└── ...

⚙️ Installation & Usage

1. Compile

make all
# or
make

2. Run

Open two terminals:

Terminal 1 (Manager):

make run_fss_manager

Terminal 2 (Console):

make run_fss_console

⚠️ Important Notes:

  • config_file must be inside the fss_manager directory.
  • All source_dir and target_dir paths should be relative to fss_manager.
    • Example: ../source_dir ../target_dir if outside, or just source_dir if inside.
  • To change arguments, edit the Makefile.

3. Console Commands

add <source_dir> -> <target_dir>
shutdown

📖 Implementation Details

Manager

  • Reads configuration and spawns workers for synchronization.
  • Tracks sync state with a linked list (sync_info_mem_store) keyed by:
    • Watch descriptor (inotify)
    • Folder name
    • Worker PID
  • Handles pipes, signals, and logging.
  • Runs two phases: initial sync, then incremental monitoring via inotify.

Console

  • Accepts user commands and communicates via named pipes.
  • Supports add and shutdown.
  • Maintains a log file for all activity.

Worker

  • Handles file copy, delete, and modify using low-level system calls.
  • Produces execution reports and error logs.
  • Supports full directory sync and single-file operations.

📌 Known Limitations

  • Console log output incomplete.
  • No .sh wrapper provided.
  • Some commands parsed but not fully executed.
  • add may behave differently depending on the environment.
  • Logging not fully consistent across components.

🔮 Future Improvements

  • Add more console commands (remove, modify).
  • Improve error handling and logging.
  • Provide shell scripts for easier execution.
  • Enhance cross-system stability.

🎓 Academic Context

This project was developed for a university systems programming course, demonstrating proficiency in:

  • Linux system-level programming
  • Process & resource management
  • Inter-process communication (IPC)
  • Real-time file synchronization

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published