• 0 Posts
  • 30 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle




  • It’s weird because usually the people writing the expressions want to communicate clearly, and stuff like 1/2x is not immediately clear to everyone, so they write the 1/2 as a fraction.

    The same expression on both sides of the division sign only reduce to one if they actually bind to the division sign, which is rarely an issue, but that is exactly the thing that is in question here. I think it’s clear that 1 + 1/1 + 1 is 3, not 1, even though 1+1 = 1+1.

    But as you said, of course, the evaluation order is just convention, you can just as well write everything in https://en.m.wikipedia.org/wiki/Reverse_Polish_notation


  • your first line is correct, but while it looks like 1 (and it might be under different conventions), evaluating according to standard rules (left to right if not disambiguated by pemdas) yields

    2(2+2)/2(2+2) = 2(4)/2(4) = 2*4/2*4 = 8/2*4 = 4*4 = 16

    Using implicit multiplication in quotients is weird and really shouldn’t happen, this would usually be written as 8/(2*(2+2)) or 8/2*(2+2) and both are much clearer

    Your second thing only works if you treat 2(2+2) as a single “thing”, which it looks like, but isn’t, in this case








  • Almost all programs use both 32bit and 64bit integers, sometimes even smaller ones, if possible. Being memory efficient is critical for performance, as L1 caches are still very small.

    Garbage collection is a feature of programming languages, not an OS. Almost all native linux software is written in systems programming languages like C, Rust or C++, none of which have a garbage collector.

    Swap is used the same way on both linux and windows, but kicking toolbar items out of ram is not actually a thing. It needs to be drawn to the screen every frame, so it (or a pixel buffer for the entire toolbar) will kick around in VRAM at the very least. A transfer from disk to VRAM can take hundreds of milliseconds, which would limit you to like 5 fps, no one retransfers images like that every frame.

    Also your icon is 1.1Mbit not 1.1MB

    I have a gentoo install that uses 50MB of ram for everything including its GUI. A webbrowser will still eat up gigabytes of ram, the OS has literally no say in this.



  • Well landau notation only describes the behaviour as an input value tends to infinty, so yes, every real machine with constant finite memory will complete everything in constant time or loop forever, as it can only be in a finite amount of states.

    Luckily, even if our computation models (RAM/TM/…) assume infinite memory, for most algorithms the asymptotic behaviour is describing small-case behaviour quite well.

    But not always, e.g. InsertionSort is an O(n^2) algorithm, but IRL much faster than O(n log n) QuickSort/MergeSort, for n up to 7 or so. This is why in actual programs hybrid algorithms are used.