Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 452 453 [454] 455 456 ... 635

Author Topic: The small random questions thread [WAAAAAAAAAAluigi]  (Read 667041 times)

Rolan7

  • Bay Watcher
  • [GUE'VESA][BONECARN]
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6795 on: January 02, 2021, 08:40:07 pm »

Reelya is certainly qualified as such.
Logged
She/they
No justice: no peace.
Quote from: Fallen London, one Unthinkable Hope
This one didn't want to be who they was. On the Surface – it was a dull, unconsidered sadness. But everything changed. Which implied everything could change.

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6796 on: January 02, 2021, 08:48:45 pm »

Hold up, Reelya's a he? I thought it was a bit of a gender-never-defined situation, we went over this a while ago.
Logged

Vector

  • Bay Watcher
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6797 on: January 02, 2021, 10:34:38 pm »

I'm proud of you, Bay. You've grown a lot over the past 10 years.
Logged
"The question of the usefulness of poetry arises only in periods of its decline, while in periods of its flowering, no one doubts its total uselessness." - Boris Pasternak

nonbinary/genderfluid/genderqueer renegade mathematician and mafia subforum limpet. please avoid quoting me.

pronouns: prefer neutral ones, others are fine. height: 5'3".

King Zultan

  • Bay Watcher
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6798 on: January 03, 2021, 02:10:46 am »

Are you guys sure he isn't still on holiday?
Logged
The Lawyer opens a briefcase. It's full of lemons, the justice fruit only lawyers may touch.
Make sure not to step on any errant blood stains before we find our LIFE EXTINGUSHER.
but anyway, if you'll excuse me, I need to commit sebbaku.
Quote from: Leodanny
Can I have the sword when you’re done?

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6799 on: January 03, 2021, 04:13:07 am »

When I formatted my old SSD by writing zeroes to the entire drive using dd, I noticed something. It reported a speed of 413MB/s, despite being connected over a USB-to-SATA cable (with USB 3.0), which is strange to me, considering that all the hard drives I've connected are all capped at 100MB/s. (I would've issued an ATA Secure Erase with hdparm, but all the guides I've read say that doing this with a USB-connected drive will brick it. I'm not too keen on disassembling my laptop yet again to do that.)

I know that writing zeroes is incredibly simple, but is there some oddity with USB-to-SATA controllers where some are limited to 100MB/s over a USB 3.0 connection, and some are able to go faster than that?

CrystalDiskInfo says that my external HDD (the ones limited to 100MB/s) uses a "USB (Serial ATA)" interface. The new USB-to-SATA cable produces "UASP (Serial ATA)". Is there some speed limit difference I'm not aware of between UASP and (probably) USB Mass Storage? Wikipedia says that UASP is faster, but no hard numbers are given.
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6800 on: January 03, 2021, 12:47:42 pm »

It's possible there's a drive command for "write all zeros to sector", shorter than just sequentially writing zeros, which could allow for greater bandwidth in this scenario.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6801 on: January 03, 2021, 01:59:15 pm »

Yes. On linux it is invoked thusly:

sudo dd if=/dev/zero of=/dev/sda bs=4096

This reads from the special memory device /dev/zero , which returns an endless stream of zeros when read from.  It then writes that output to each subsequent sector on /dev/sda (scsi disk a), in 4kb increments. (4kb is used, since most modern drives actually have 4kb native sectors, and this is the easiest for such drives to handle.)


One could instead fill the drive with random garbage, using /dev/urandom as the input device.



As pertains to the original query--  SSDs contain a microcontroller in them that handles wear leveling, caching, and the actual heavy lifting of writing to flash memory arrays.  It is possible that the drive has a special mode it detects when it is fed lots of zeros, and that it is able to simply commit those writes immediately based on the mode.

Faster still, would be to use hdparm to initiate a secure erase.

https://www.thomas-krenn.com/en/wiki/Perform_a_SSD_Secure_Erase

« Last Edit: January 03, 2021, 02:04:26 pm by wierd »
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6802 on: January 03, 2021, 03:38:59 pm »

I meant a storage driver command, not a command line command. So the driver can send the drive some firmware-defined command to erase sector so-and-so, which can allow for more bandwidth throughput than sequentially writing zeros. I was responding to methylatedspirit.

Apparently SATA specifications are paywalled otherwise I would look up whether SATA has such a command.
« Last Edit: January 03, 2021, 03:44:42 pm by bloop_bleep »
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

bloop_bleep

  • Bay Watcher
    • View Profile
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6804 on: January 04, 2021, 04:20:25 am »

I tested it in CrystalDiskMark using the Peak Performance preset at 16MB to test the interface's max bandwidth instead of the drive itself. Then, I used ATTO Disk benchmark using a queue depth of 256 to also make sure that it's the interface that's bottlenecking it, not the drive itself. The max speed is what matters here. Write caching was enabled on both drives.

Spoiler: SSD using UASP (click to show/hide)
(Keep in mind, you'll almost never encounter 200MB/s in the HDD in real-world use. This is an unrealistic scenario to test the limits of the interface.)

You know, I came into this thinking that USB Mass Storage Class was inherently hard-limited to 100MB/s, regardless of caching or whatever, but the data tells a different story. I suppose this is a "hard to say", not unless I disassemble my external HDD and swap the HDD for an SSD. Complicating matters further is that the SATA-to-USB board in there uses SATA II, not SATA III despite the HDD supporting it, so then I'm gonna hit a bottleneck at 300MB/s from the SATA II interface.

Now, if I can find a USB-to-SATA adapter that uses USB MSC and does SATA III, I'd have a good chance of testing out how much faster UASP is than MSC. I have a couple of enclosures at home and those might fit the bill, but then again, I might just hit the limit of SATA III or the drive itself at that point. I heard Samsung has the fastest SATA drives, but I'm not sure I want to spend money for what is essentially nothing.
« Last Edit: January 04, 2021, 04:25:16 am by methylatedspirit »
Logged

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6805 on: January 04, 2021, 05:03:45 am »

The data about how fast a USB device can signal is easily evaluated within a pretty reasonable margin of error, simply based on what the spec asserts.


If this is a USB3.0 drive, then the theoretical maximum the device can communicate at is 625mb/sec.  Assuming a good and spacious cache in the device, that can translate to very speedy performance over that interface.

USB 2.0 on the other hand, is much more limited, and has a maximum theoretical speed of 120mb/sec.  (this likely where your idea of a 100mb/sec maximum has come from.)

USB 1.1/1.2 clocks in at an abysmal 1.5mb/sec, more or less.
Logged

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6806 on: January 04, 2021, 06:14:54 am »

I suppose, but there's 3 layers here in the case of connecting a SATA drive to USB. You have the USB connector (and associated controllers), the SATA-to-USB translation layer, and then the drive itself (if my understanding of the architecture is correct). SATA and USB do not map to the same pins, so there's something that must translate between those protocols. The slowest of the bunch is what determines the actual speed.

USB 3.0 goes up to 625MB/s, but SATA III only goes up to 600MB/s anyways. So then the only thing remaining is what that translation layer, no? I think you could split it further and say there's a software and a hardware component to it, but let's assume that they're all the same. Let's pretend that only the software layer changes. (Or else I'd have to buy a fuckton of different USB-to-SATA adapters to say much of anything.)

So now you have USB Mass Storage Class and UASP. "Is there a difference between the two?" is then the question I want to answer. USB MSC is more general, while UASP uses the native SCSI commands. UASP may be faster, but by how much?
Logged

methylatedspirit

  • Bay Watcher
  • it/its
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6807 on: January 05, 2021, 01:34:15 am »

Suppose you had two continuous functions that can be integrated, f(x) and g(x), and you wanted to find the area between those functions between some arbitrary values of x, x1 and x2. Assume it's an "easy" (the region being integrated is always either above or below the x-axis) question. So then you have to find the definite integral of f(x) - g(x) between x1 and x2 with respect to x, right?

Does it matter at all if you swap the places of f(x) and g(x)?

My answer would go as follows: No, since it's area, by right, the answer must be positive in the end, taking the absolute value of the definite integral. The only difference it would make is that the definite integral is negative, but it's the same magnitude as when you do it the "right" way around. That doesn't matter, since you're already taking the absolute value in the first place because it's area. This is distinct from the case where the question asks directly for the definite integral of f(x) - g(x) between x1 and x2 rather than the area between two curves from x1 to x2.

But for some reason, my lecturer says that I cannot do this kind of function-swapping willy-nilly, since the absolute value function is only used when "needed". But... it's area. It is, by definition, needed. It's the same magnitude anyway, and area is entirely magnitude anyway. Since when could area, the product of two lengths, be negative or have direction in general? (I think linear algebra has some concept that corresponds roughly to area, but it's a signed value, but I don't remember what it is. That's besides the point, though.)

I don't get her reasoning at all. Why does she think this way? Is there an odd gotcha that happens later on in Calculus where you can't do this and expect the correct answer?
Logged

Vector

  • Bay Watcher
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6808 on: January 05, 2021, 01:39:12 am »

You rang? LOL.

We used to have a math thread for this kind of thing.

Think about it like this: If I subtract, say, 5 from 3 (as in "go east 3 miles and then west 5 miles") then I get a "signed distance." Similarly, the "signed area" given by the integral. Why? As you might guess from the previous example, it's important to do things this way because it's compatible with how we want to describe physics.

The linear algebra concept that you're thinking about is the determinant, which is the signed area/volume/whatever of the region described by the column vectors making up the matrix. It's actually "integral" to calculating higher-dimensional integrals, heh.
Logged
"The question of the usefulness of poetry arises only in periods of its decline, while in periods of its flowering, no one doubts its total uselessness." - Boris Pasternak

nonbinary/genderfluid/genderqueer renegade mathematician and mafia subforum limpet. please avoid quoting me.

pronouns: prefer neutral ones, others are fine. height: 5'3".

Ulfarr

  • Bay Watcher
  • Going on a pilgrimage to Mars
    • View Profile
Re: The small random questions thread [WAAAAAAAAAAluigi]
« Reply #6809 on: January 05, 2021, 03:57:53 am »

Strictly speaking, 5 /= -5, so your teacher is right. However you can swap the functions if you just swap the boundaries, which they should have told you ::)

Sx1x2 [f(x) - g(x)] dx = - Sx2x1 [f(x) - g(x)] dx = Sx2x1 [g(x) - f(x)] dx


While your reasoning isn't without merit, it's only true in this specific case, so I'd like to think that they are just trying to ensure that you have a solid understanding of the general idea, which you can then apply as you see fit.
Logged
Bring Kobold Kamp to LNP! graphics compatibility fix.

So the conclusion I'm getting here is that we use QSPs because dwarves can't pilot submarines.
Pages: 1 ... 452 453 [454] 455 456 ... 635