Weird disc behaviour

Discussion of chess software programming and technical issues.

Moderator: Ras

Modern Times
Posts: 3699
Joined: Thu Jun 07, 2012 11:02 pm

Re: Weird disc behaviour

Post by Modern Times »

JohnWoe wrote: Wed Dec 04, 2024 11:00 pm C code and Windows. Memory leaking, throttling or Windows doing funny things. I would bet it will run flawlessly on Linux and C++ streams.
Of course. It is always Windows at fault, and Linux is always the answer.
User avatar
hgm
Posts: 28337
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Weird disc behaviour

Post by hgm »

Note that an SSD ('Solid-State Drive') is not a disc.
Modern Times
Posts: 3699
Joined: Thu Jun 07, 2012 11:02 pm

Re: Weird disc behaviour

Post by Modern Times »

hgm wrote: Fri Dec 06, 2024 10:59 am Note that an SSD ('Solid-State Drive') is not a disc.
Indeed not but I assumed he likely was running an SSD.
User avatar
Eelco de Groot
Posts: 4655
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Weird disc behaviour

Post by Eelco de Groot »

Ras wrote: Sat Nov 30, 2024 12:56 pm
Rebel wrote: Sat Nov 30, 2024 8:58 amSuch as the "copy" instruction probably does, copying files goes with 440 million bytes per second.
440MB/s sounds like an SATA SSD - an HDD probably wouldn't reach that, and the SATA interface bandwidth tops out at 600MB/s. An NVMe SSD should be a lot higher with sequential access. As for why, I think it's the SLC cache of the SSD. 2 bio positions with 40 bytes is around 80GB. Typical PCs have between 16 and 64GB of RAM, so that wouldn't even fit unless you have a PC with unusually much RAM. 80GB is on the order of maginitude I'd expect for the SLC cache of a 1TB drive, though that size often also depends on how full the drive is.
Sounds like a good analysis. Ed could upgrade but then he would have to install everything again I think. If you have to do this every day it would be worth it for sure. If Ed's HP does not have such a NVMe (PCIe instead of SATA I read) typical upgrade prices Queensystems :):
Meerprijs voor: 480GB SSD

- HP Z-Drive Turbo 512GB M.2 Sata € 59,00
- HP Z-Drive Turbo 256GB M.2 NVMe € 69,00 > 6 x sneller als normale SSD
- HP Z-Drive Turbo 512GB M.2 NVMe € 99,00 > 6 x sneller als normale SSD
- HP Z-Drive Turbo 1TB M.2 NVMe € 179,00 > 6 x sneller als normale SSD
- HP Z-Drive Turbo 2TB M.2 NVMe € 289,00 > 6 x sneller als normale SSD
But from what you say then also enough RAM
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
petero2
Posts: 722
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Weird disc behaviour

Post by petero2 »

Rebel wrote: Sat Nov 30, 2024 8:58 am You both make sense.
hgm wrote: Sat Nov 30, 2024 6:36 am It might help to explicitly buffer large chunks of data, and write those out without any reading in between.
Such as the "copy" instruction probably does, copying files goes with 440 million bytes per second.
This can be implemented by simply making the built-in FILE buffers larger, like this:

Code: Select all

        fp1 = fopen(bin_one, "rb");
        fp2 = fopen(bin_two, "rb");

        int bufSize = 1000000;
        setvbuf(fp1, malloc(bufSize), _IOFBF, bufSize);
        setvbuf(fp2, malloc(bufSize), _IOFBF, bufSize);

next:   x=fread(&k1,8,1,fp1); if (x<1) goto done;
The buffers will never be freed though, so a real implementation would have to keep track of the allocated memory and deallocate it when no longer needed.
User avatar
Ras
Posts: 2694
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Weird disc behaviour

Post by Ras »

Eelco de Groot wrote: Fri Dec 06, 2024 9:02 pmEd could upgrade but then he would have to install everything again I think.
When I changed my SATA SSD for an NVME drive, I used the same size and just cloned the whole installation with Clonezilla. Clonezilla was even smart enough to realise that the fstab entries would be off because the device names for SATA and NVMe partitions are different, so it offered to adjust that. Then again, I'm on Linux, and I'm not sure how easy Windows would take that.
Rasmus Althoff
https://www.ct800.net
User avatar
Rebel
Posts: 7297
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Weird disc behaviour

Post by Rebel »

petero2 wrote: Fri Dec 06, 2024 10:03 pm This can be implemented by simply making the built-in FILE buffers larger, like this:

Code: Select all

        fp1 = fopen(bin_one, "rb");
        fp2 = fopen(bin_two, "rb");

        int bufSize = 1000000;
        setvbuf(fp1, malloc(bufSize), _IOFBF, bufSize);
        setvbuf(fp2, malloc(bufSize), _IOFBF, bufSize);

next:   x=fread(&k1,8,1,fp1); if (x<1) goto done;
The buffers will never be freed though, so a real implementation would have to keep track of the allocated memory and deallocate it when no longer needed.
Will try that.
90% of coding is debugging, the other 10% is writing bugs.