3

Consider a scenario in which two applications have to share data among them. I can think of three ways-

  1. Shared memory ( Boost I am allowed to use )
  2. D-Bus ( glib / Qt implementation allowed )
  3. File operations on a common file between the two application.

Q1. Which should be my approach considering data to be shared is going to be very large ( some 10K song names for example ).

Q2. Will doing file operation affect speed, compared to the others, as Hard disk would be involved ?

Q3. Is there any other approach available with better speed?

Language of implementation - C++

Amit Tomar
  • 4,800
  • 6
  • 50
  • 83

1 Answers1

2

You may want to consider using the QtSql module to use a database, specifically SQLite.

The SQLite database is a cross-platform in-process database engine. This allows you to store structured data easily and access it concurrently and safely between processes, the processes can even be written in different languages.

SQLite works fine with millions of records, is very fast and reliable. The main problem is with processes both writing as it uses database level locking, so no other process can read or write to the database during the write operation.

The other benefit to using QtSql is that in the future you can easily make the programs work across a network by using a database server such as PostgreSQL or MySQL.

Silas Parker
  • 8,017
  • 1
  • 28
  • 43
  • Thanks for the reply. But due to some project constraints I will not be able to use SQLite. If someone could pick the best approach from the options given above? – Amit Tomar Dec 26 '11 at 06:24