in reply to Re^2: Spawning processes from scalars
in thread Spawning processes from scalars
That is fairly easy to do under ubuntu. Firstly create a tmpfs partition of a suitable size, and define a mount point.
In your /etc/fstab:
none /binary_exec tmpfs size=2G 0 0
Or on the command line (as root)
mount none /binary_exec -t tmpfs -o size=2G
The mount point for the tmpfs partition must be created as a directory first. It need not be in the root of your file-system.
You can be quite generous with the size of the tmpfs volume, as it is only the upper limit for the file-system, so you won't consume 2G of RAM just by creating the file-system, only the total size of the files you write there, and in any case file data in tmpfs will get swapped out if the fs is large enough to cause memory pressure.
Once you have created the temporary partition, you can write your executable binary there from your perl scalar in the normal way. It should be very quick as you are just copying bytes from one part of ram to another. From there it is trivial to run the executable. You can also delete files just as quickly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Spawning processes from scalars
by fluffyvoidwarrior (Monk) on Apr 25, 2011 at 22:39 UTC |