Reputation: 13
Good morning. Everyone.
I am working with qt 4.8. (Embedded linux) The server application is executing the client application using qprocess(). At this point, the client application is slow to load, so the system appears to be paused when the user sees it.
I think the reason for the slowness is the time to load the external library into memory. So I wonder if there is a way to pre-load the library to be used by the client application when the server application goes through the init process.
Please let me know if there is a better way. Thank you.
Upvotes: 0
Views: 413
Reputation: 458
Preload and prelink might help. Never used them but found some documentation to start: https://wiki.archlinux.org/index.php/Preload
Upvotes: 0
Reputation: 4029
Since the other application will have to load its own libraries on startup this is not an easy task, but you could get around the slow loading by preparing the desired application and its libraries to be loaded from ramdisk instead of loading from hard-disk.
In Main Application create a RAM disk using mount
sudo mount -t tmpfs -o size=200M none /mnt/ramdisk
copy all required files over and set up $LD_LIBRARY_PATH
as an environment to point to your ramdisk (Qt)
auto env = QProcess::systemEnvironment();
env.insert("LD_LIBRARY_PATH","/mnt/ramdisk");
Set the new environment to be your environment for your QProcess. As I am not 100% sure this will load your library from there, as an alternative you could create a chroot
environment and setup libraries in /usr/lib
in the chroot environment.
The idea is to get the library and application loaded from RAM into RAM, which is much faster than loading from disk.
Upvotes: 1