PureBasic Interface to ImDisk

Share your advanced PureBasic knowledge/code with the community.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi marroh,

You're welcome.

-----------------------------------------------------------------------

Updated:
- added 1 example
-- MountDevice.pb: mounts an image file to virtual memory or relinks an image file

Mounting a device is now a separate example, removed from: CreateDevice2.pb.
- an image file can be mounted to virtual memory multiple times

NB*: RemoveDevice1.pb is better suited to remove devices mounted to virtual memory. If RemoveDevice2.pb is used, you may be prompted to save changes.

-----------------------------------------------------------------------

Updated: RemoveDevice1.pb
- if an image file is mounted to virtual memory and the contents are modified, changes will be saved back to the original file; previously a new file was created.

NB*: I've also reintroduced the Function: ImDiskSetAPIFlags with the "Force Remove" parameter to avoid an additional message box.

-----------------------------------------------------------------------

Updated the examples with various optimizations, nothing worth documenting.

-----------------------------------------------------------------------

Updated:
- fix an issue with the Include files, should now run in PureBasic 5.24 LTS (x86 / x64)

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
graves
Enthusiast
Enthusiast
Posts: 160
Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper

Re: PureBasic Interface to ImDisk

Post by graves »

Hi, JHPJHP

ImDisk can't be installed without Administrator privileges (on XP).
But it says "Installation OK" and no error message is displayed.

Some like "You dont have Administrator privileges", and abort installation, would be very appreciated.

Excellent application. Just need a "key-to-open".
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi graves,

Can you provide more information, there shouldn't be anything to install unless you're referring to messages returned from: CreateDriverService.pb?
graves wrote:Just need a "key-to-open".
I'm not sure what key you're referring to, please provide additional information.

NB*: The examples are only simple templates, designed to make it easier to include the ImDisk functionality in your own applications.
Last edited by JHPJHP on Wed Feb 11, 2015 7:08 pm, edited 1 time in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
graves
Enthusiast
Enthusiast
Posts: 160
Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper

Re: PureBasic Interface to ImDisk

Post by graves »

Hi again,
Logon as "simple user" (no Administrator privileges), and execute "imdiskint.exe":
Message: This will install ImDisk Virtual Disk Driver with the imdisk.exe coomand line tool and a Control, Panel applet ¿Continue?

Some time waiting, and ERROR message appears: Installation error

Then Setup OK message: Setup finished succesfully. Open ImDisk Virtual Disk driver applet in Control Panel or use ImDisk to manage your virtual disks!

No more information on screen nor Windows logs

Key-to-open:
It's an optional upgrade, requesting a user key before mounting a virtual disk.

Regards
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi graves,

I think there's been some confusion, don't install imdiskint.exe (from the creators website), I've scripted an interface to the binaries.

Download the package from the first post.
- self contained interface to ImDisk (binaries included)

First you will need to run setservice/CreateDriverService.pb. You may receive an error if you don't have the necessary rights.

In the root folder are examples that can be run from PureBasic x86 or x64, providing the service has been successfully installed.
- see the first post for details describing the various examples and related information
Last edited by JHPJHP on Sun May 27, 2018 4:26 pm, edited 1 time in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: PureBasic Interface to ImDisk

Post by heartbone »

heartbone wrote:Make Firefox Faster By Putting Profile and SQLite Database in RAMDisk something that I will try very soon.
If it makes a significant difference, I'm going to identify other areas to implement its use.
It's not the same as running the OS from a SSD, but it is cheaper, and possibly safer.
Startup was significantly faster.
Unfortunately on the second startup, Firefox got confused and created an entirely new profile, effectively wiping out my customizations.
Since I had Firefox on lockdown at version 28, I decided to update to the latest 35 and stick with that for a while.
Although the ramdisk software itself works swell, but I am not going to try to do that optimization to Firefox again.
Keep it BASIC.
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Re: PureBasic Interface to ImDisk

Post by Opcode »

While good work I think the concept of a RAM Disk is dying. It's nearly pointless these days with the use of solid state drives. Which have become affordable enough for any consumer. :)
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi Opcode,

Thank you for your feedback.

Have you compared the speeds? I'd be interested in the results of an SSD to RAM Disk comparison. I've only had the chance to compare an HDD to RAM Disk and the discrepancy was huge.
- I read that a RAM Disk can be 10 times faster under certain conditions then an SSD, but it would be nice to get conformation either way
-- http://lifehacker.com/5969767/add-a-ram ... erformance
-- http://memory.dataram.com/support/ramdi ... upport-faq

Test tool: http://crystalmark.info/software/Crysta ... dex-e.html

If you or anyone else has a chance to test this (SSD available) please use the following examples: CreateDevice1 and RemoveDevice1.
- CreateDevice1: creates a RAM Disk that operates directly in memory

NB*: A RAM Disk (volatile memory) can also be used programmatically to create a secure temporary storage area easily deleted, but impossible to recover.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Re: PureBasic Interface to ImDisk

Post by Opcode »

JHPJHP wrote:Hi Opcode,

Thank you for your feedback.

Have you compared the speeds? I'd be interested in the results of an SSD to RAM Disk comparison. I've only had the chance to compare an HDD to RAM Disk and the discrepancy was huge.
- I read that a RAM Disk can be 10 times faster under certain conditions then an SSD, but it would be nice to get conformation either way
-- http://lifehacker.com/5969767/add-a-ram ... erformance
-- http://memory.dataram.com/support/ramdi ... upport-faq

Test tool: http://crystalmark.info/software/Crysta ... dex-e.html

If you or anyone else has a chance to test this (SSD available) please use the following examples: CreateDevice1 and RemoveDevice1.
- CreateDevice1: creates a RAM Disk that operates directly in memory

NB*: A RAM Disk (volatile memory) can also be used programmatically to create a secure temporary storage area easily deleted, but impossible to recover.
Certainly in terms of raw bandwidth a solid state drive wont be able to compete with system memory. Tho most people who use RamDisks use it as a hit cache for their browsers and other stuff which makes no difference when running on a solid state drive. NAND has less than a 0.1 ms seek time which is why it's kind of pointless. As to where traditional mechanical drives have an average seek time of 8.5 ms. Running a solid state drive is like having system memory as your storage medium except without the massive amounts of bandwidth. If you have software that relies on heavy I/O then certainly a RamDisk is the way to go. Tho for pretty much everything you do on a daily basis a RamDisk is pretty much pointless for someone running a solid state drive.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi Opcode,
Opcode wrote:Certainly in terms of raw bandwidth a solid state drive wont be able to compete with system memory.
I agree.
Opcode wrote:Tho most people who use RamDisks use it as a hit cache for their browsers and other stuff which makes no difference when running on a solid state drive.
Most people aren't programmers, and I tend to believe we think outside the box.
- http://www.purebasic.fr/english/viewtop ... 28#p459128
Opcode wrote:Tho for pretty much everything you do on a daily basis a RamDisk is pretty much pointless for someone running a solid state drive.
I don't agree, but I respect your right to an opinion.
- Move Your Caches to a RAM Disk to Reduce Wear on SSDs

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Re: PureBasic Interface to ImDisk

Post by Opcode »

JHPJHP wrote:Hi Opcode,
Opcode wrote:Certainly in terms of raw bandwidth a solid state drive wont be able to compete with system memory.
I agree.
Opcode wrote:Tho most people who use RamDisks use it as a hit cache for their browsers and other stuff which makes no difference when running on a solid state drive.
Most people aren't programmers, and I tend to believe we think outside the box.
- http://www.purebasic.fr/english/viewtop ... 28#p459128
Opcode wrote:Tho for pretty much everything you do on a daily basis a RamDisk is pretty much pointless for someone running a solid state drive.
I don't agree, but I respect your right to an opinion.
- Move Your Caches to a RAM Disk to Reduce Wear on SSDs
Certainly solid state drives are limited to so many write cycles tho that article is pure malarkey (someone who doesn't know hardware). Solid state drives have a far longer lifespan than mechanical drives. Tho it all boils down to how I/O intensive your software is. With standard desktop software most solid state drives will last in excess of 20 years regardless to how much you use the machine daily. The only time I would be concerned about the longevity of a solid state drive is when you're doing highly intensive I/O workloads around the clock (writing terabytes of data daily). Most standard users wont even reach the 100 GB marker for how much data that is written to their drives daily. I would give Google another shot as there are tests of drives such as the 840 Pro reaching in excess of 2 Petabyte of data written to the drive without failure. Even then with 100 GB of data written daily it would take 54 years before reaching the failure point of the drive. Back in solid state drive infancy firmware and NAND surely wasn't made to live up to the expectations of drives today. Tho today if you go out and buy a MX200 it will more than likely last you longer than the lifespan of not only your current machine but also your next build. The point I'm trying to get across is solid state drives remove the use of RamDisks entirely for consumers. Web browser caches and what not are only a couple hundred megabytes in size and only fluctuate ever so slightly. I'm not trying to discredit your work as it's a nice job. Tho I am just merely making the suggesting that RamDisks have become extinct among consumer machines. That is unless you're still running an old mechanical hard drive which has a terrible seek time.
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: PureBasic Interface to ImDisk

Post by yrreti »

I'm not trying to change this post, but!
Opcode, I was hoping the same thing regarding ssd's.
I've had hard drive failures before, but always managed with backup etc. I recently tried my first ssd replacement
for my laptop. I needed a larger capacity drive. It was a brand new Samsung 840 pro. I chose that model because it
had much more favorable comments about it then the 850. It installed nice and, but within in a week, I started to
get disk errors and other anomalies. Not reliable! Granted, I might have just gotten a bad one off the shelf.
But it sure makes you lack confidence in using them again. I have since replaced it with a regular hard drive, and it's
still working great.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to ImDisk

Post by JHPJHP »

Hi yrreti,

That was my experience as well, but instead of replacing the drive I bought a new laptop which came standard with an HDD. Don't get me wrong I would have preferred another SDD because of the speed it offered, but it does show that concerns of the past apply today.

--------------------------------------

Hi Opcode,

Admittedly I posted the first Google Search I found concerning RAM Disks and SSD's which may have been malarkey, I don't know - that wasn't my point. But you seem fixated on proving your opinion which can only be based on web-facts in a thread created to expand ideas not stifle them.
Last edited by JHPJHP on Sun May 27, 2018 4:27 pm, edited 1 time in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Re: PureBasic Interface to ImDisk

Post by Opcode »

yrreti wrote:I'm not trying to change this post, but!
Opcode, I was hoping the same thing regarding ssd's.
I've had hard drive failures before, but always managed with backup etc. I recently tried my first ssd replacement
for my laptop. I needed a larger capacity drive. It was a brand new Samsung 840 pro. I chose that model because it
had much more favorable comments about it then the 850. It installed nice and, but within in a week, I started to
get disk errors and other anomalies. Not reliable! Granted, I might have just gotten a bad one off the shelf.
But it sure makes you lack confidence in using them again. I have since replaced it with a regular hard drive, and it's
still working great.
You must of gotten a faulty unit which can happen and is probable with any piece of computer hardware. I would of given it another shot with an RMA as once you get a drive that's not faulty it's literally a day and night difference from slow mechanical drives. It's all about that silicon lottery I have one of the cheapest SSD's (Kingston V300) that has been running straight for 2 years now. Samsung's 840 Pro is one of the best drives on the market certainly (other than their new V-NAND 850 Pro's) along with Crucial's MX and BX line in terms of value.
JHPJHP wrote:Hi yrreti,

That was my experience as well, but instead of replacing the drive I bought a new laptop which came standard with an HDD. Don't get me wrong I would have preferred another SDD because of the speed it offered, but it does show that concerns of the past apply today.

--------------------------------------

Hi Opcode,

Admittedly I posted the first Google Search I found concerning RAM Disks and SSD's which may have been malarkey, I don't know - that wasn't my point. But you seem fixated on proving your opinion which can only be based on web-facts in a thread created to expand ideas not stifle them.

To everyone else I apologize, this forum is supposed to be about Tricks 'n' Tips, but when someone throws around words like "extinct" and "pointless" I'm amazed at the arrogance; who knows if RAM Disks have a future and in what capacity. This thread started from a "what-if", and those types of questions always peek my interest.
It's not an opinion, it's fact. I spend a lot of time in the hardware enthusiast realm and know hardware probably better than any single user here on this forum (no ego or e-peen trip). Hard drives are actually more commonly bad out of the gate than solid state drives (mechanical hardware is easily damageable).

You don't need to apologize for the discussion at hand as like said none of my posts are intended to render your work completely useless. I was merely throwing it out there that RamDisks are useless in a solid state environment unless you heavily rely on I/O. Does this make a RamDisk completely unusable and pointless? Certainly not as in the proper environment software can benefit from the massive amounts of bandwidth allowed by a RamDisk. Or like said if you're doing heavy I/O workloads (1 TB+ writes a day) around the clock doing them on a solid state drive would be absolutely horrendous for its lifespan. There are places for a RamDisk to be used tho in the consumer market (e.g. home users) they no longer serve any advantage over solid state media.
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: PureBasic Interface to ImDisk

Post by Liqu »

Thank you very much for your hardworks JHPJHP

RamDisk is very useful for running disk-less / hardisk-less system,
to provide ultra fast speed cache, to all the clients.

It also useful for gamer to improve loading speed :)

and Memory like V-GEN has a lifetime warranty :D

Please let me know if you extend / make it to disk-less system.
Locked