[haiku-3rdparty-dev] What I am trying to do. Crazy idea explained?

  • From: "Earl Pottinger" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "earl_colby_pottinger@xxxxxxxxx" for DMARC)
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Sun, 27 Jul 2014 16:32:56 -0700

I guess I should give a more complete explanation about what I am aiming for:

First, while I know this idea seems sort of strange to be working on, but I am 
also the type of person that once I get an idea in my head I just have to try 
and see if I can do it.

Second, I know I am not a very good programmer.  I don't expect that the 
Haiku-OS developers will want to include anything I wrote. I write code to 
solve my own problems; I just hope someone else finds what I write useful to 
them also. 
 
So what am I trying to do?

1) I am not writing just one driver, there are two distinct drivers. A 
Memory_Pool driver and an updated RAM_DISK driver.

2) The Memory_Pool driver supplies an IOCTL interface to multiple Data_Pool 
programs each of which has allocated 1 GBytes of user-land memory. The driver 
transfers 64K blocks of memory to and from the Data_Pool programs and the 
program/drivers without the calling code needing to manage the memory 
structures. As far as the calling code is concerned there is just a large data 
block which using IOCTLs to the driver to request a transfer of a selected 64K 
block of memory.

3a) The RAM_DISK driver is already written, but needs to be modified to work 
with the Memory_Pool driver instead of a hard drive. It already has a 
poor-man’s MMU already in the code and allocates 128 MB -512 MB as its Heap in 
Kernel-Memory-Space. To create a larger drive you could allocate more memory 
but this would be taken from Kernel-Memory-Space so this is a bad idea. Instead 
the present code writes the less recently used block of data to the hard drive 
and frees up the memory for use again.

3b) So why do I want a RAM_DISK when it does basically what Haiku’s disk cache 
already does?

Four reasons:

First, the RAM_DISK loads at boot its own internal image from before the last 
shut-down, thus it is already to use with any files pre-loaded as soon as Haiku 
is ready to use. Note: This idea was stolen from Alexander G. M. Smith who is a 
far smarter person than me.

Second, the code supplies the ability to do the read/writes across multiple 
drives; in effect it creates a poor-man’s RAID-1 drive.  And the drives don’t 
even need to be the same size for it to work.

Third, I sometimes get odd speed results from Haiku’s caching system, at times 
it is lightning fast and at other times it does not seem to cache the drives I 
am using at all. All my drives are SSDs but even then I can see the speed 
difference. My RAM_DISK is slower than Haiku at its best but far better than 
when it is at its worse.

Fourth, it is just fun to write code you have never seen anywhere else. :) What 
else can I say?

3d) The RAM_DISK driver needs to be changed so instead of writing to the hard 
drive, the blocks to be freed need to be written to the Data_Pool thru the 
Memory_Pool driver. The speed of the RAM-to-RAM is still faster than even the 
SSDs in my systems. IE. 4-5 GBytes per second vs 450+ MBytes per second.  Tim 
Allen has nothing on me, I MUST HAVE MORE SPEED!!!

4) The Memory_Pool driver is not just for the use of the RAM_DISK driver, which 
is why I did not just write the code directly into RAM_DISK driver. Instead it 
can be used by any 32 Bit program that wants to access more memory in 32 Bit 
Haiku-OS.




I have already tested prototypes of the Data_Pool programs, each allocated an 
(one)1 Gbyte array I was able to launch 16 instances on my machine which has 
32GB of ram, the 16 programs took up less than 17 GBytes of working memory. And 
other programs on Haiku continued to run fine. Now I have to debug the 
Memory_Pool driver and confirm its operation and then modify the RAM_DISK 
driver.

Why not a 64 Bit version?  My coding ability is not good enough, all I get is 
BAD_DATA when I try to install the drivers I try to compile under 64 Bit Haiku. 
Plus I want to use the RAM_DISK with all the programs that presently work fine 
on 32 Bit Haiku.

I hope I have not bored you with my silly idea. And I made it clearer what it 
is I want to do.


Other related posts: