What kind of csv did you upload and what filters did you use? How many books were in that csv? Were it a lot of books?
As explained, the website scrapes multiple book webpages to enrich the csv data. The csv does not have all the data which I think is nice to find a new book
If you have time, maybe you can share your csv via e.g. wetransfer?
Sure, we'll never run out of fossil fuels, because as they get more scarce, the price will go up and some reserves that used to be unprofitable will now be.
But then, we definitely don't want to burn all fossil fuels there are, because that would be catastrophic for the climate. Nevertheless, as long as it is profitable to do so we will. So we'll never run out of oil, and that is, in truth, unfortunate.
In the same manner, we'll never run out of minerals, which is also pretty unfortunate because mining is somewhat environmentally damaging.
What other kinda of optimizations can be made by using the page table?
For example, from what I understand, allocators operate on virtual memory, so if for example a vector increases in size past its capacity, memory has to be reallocated and the existing content copied. Wouldn't it be possible to perform that copy by updating virtual addresses in the page table, with no copy actually being performed in physical memory?
That still requires you to plan how you use the virtual address space, though. You can't just add more memory pages on the back of your vector if you've already started using those virtual memory locations for other stuff. So you have to know in advance how much space your vector might end up using, and carefully avoid placing anything else there. If you're willing to come up with such an estimate, and if your OS is happy to overcommit memory (and I think Linux is, by default at least), then you can just malloc() all that memory in the first place. With overcommitting no physical page will be used to back your virtual memory block until you really use it.
If your system doesn't do overcommitting, then I guess that with some mmap() trickery (using the appropriate flags) you could do more or less the same thing, reserving the virtual address space that you need and then actually backing with memory as you need.
One example that comes to mind is the (abandoned) proposal for safe arena allocation in Go. It takes advantage of the fact that 64 bit computers have absolutely massive virtual memory, so that "freed" memory can be permanently unmapped from virtual memory in order to make any future accesses an error instead of a use-after-free bug.
There’s a great paper from the group of Emery Berger, where they merge memory pages that become sparse. A kind of garbage collection for C and C++ languages. There’s also a good presentation about it on youtube.
Technically yes, you can do copy-on-write semantics, which marks both the original and "copied" page as read-only, and the first write to either virtual page causes a page fault in the kernel (access violation) prompting a physical page allocation, copying the page, and then updating both virtual page table entries' permissions to be RW, then the equivalent of `invlpg` to flush them out of the TLB, before returning to the program to re-try the write instruction.
However this gets tricky with heap allocators since they often pack `malloc`-like allocations into the same page using some allocation scheme (e.g. buddy allocation, etc.). Though you can typically bypass malloc-like, in-process allocators to handle page mappings yourself, it's just a little more cumbersome.
This is actually how "virtual allocation" (I think is the term, don't quote me) happens; if you `malloc` a very large space on many modern OSes, you get a pointer back and there is an allotment in the process's virtual address space registered, but no page tables are actually updated (the kernel can assume they're "not present", meaning that there is no read nor write availability; any memory operation with that range causes a page fault). Upon any page in that range being accessed for the first time, the page fault handler sees it's part of that otherwise very large segment and will allocate in physical memory to that virtual page, then return.
It allows for e.g. allocating a VERY large sparse array of items (even terabytes!) that might otherwise exceed the size of physical memory actually available to the system, with the assumption that it'll never actually be fully populated (or at least populated across enough memory pages such that you exhaust 'real', physical memory).
This is also how file mapping works. You file map something from the filesystem, and the kernel keeps a cache of read pages from that file; memory reads and writes cause page faults if they haven't been read in (and cached), prompting a read from the disk storage into a physical page, updating the page tables, and resuming the faulting thread. It also allows the kernel to selectively reclaim less-frequently-used file mapped pages for higher priority allocations at any time really, since the next time the program tries to access that page, the kernel just faults again, reads it into a new page, and updates the tables. It's entirely transparent to the process.
I'm designing a novel kernel at the moment and some of these sorts of possibilities are what I find the more interesting parts of design, actually. I find them to be underutilized to some extent even in modern kernels :)
I did such an experiment in Canada, tracking calories and nutrients and found I could live on about 100$/month, or 3.30$/day. Although I did not reach 100% daily value for all nutrients, there were no catastrophic deficiencies (nothing under 50%).
However, if I had to save the most money, and the most time, I would definitely opt for something like Soylent or Huel. Except these are not available in Canada, and they cost way too much. I found a website where people share recipes for DIY soylent (completefoods.co) and tried one. I only bought a small batch of ingredients so the cost per day was around 3.30$, but if I had bought in bulk I'm sure I could get this down to about 2$/day. And technically, this would be the most nutritionally complete diet I ever had. If a multivitamin pill cost about 0.05$/day in bulk, so why would I spend so much on vegetables?
That said, the taste isn't great, there's no variety, and I'm sure it gets boring after a while. But it was a fun experiment, and it's enlightening to know how little one can spend to eat while the average spend for food is like 400$/month.
You're overthinking it. Fatalism has nothing to do with it.
I suppose "To die at my time" means to stop worrying about everything that can potentially harm you, enjoy life, and die whenever your body feels like it. I'm not going to stop eating sugar to save a theoretical year or two, and I'm not going to buy all kinds of air purifiers to save a few theoretical minutes of life or whatever the article says.
What difference does it make if I die at 70 or at 90? Why search so much to prolong life? The value of my life is not measured by its length.
I think you must be very young to make that last point. Basically you are saying that your whole retirement life will have no value. As someone who will probably retire in 10 or 15 years, I definitely hope to have a reasonably long and healthy retirement to enjoy. That being said, I'm not going to go to extreme measures like avoiding all sugar (which are scientifically dubious in any case)
The AI absolutely refused to let me take the morning off eating donuts and sipping coffee, I had to compromise and go to the crime scene first before being able to enjoy the blessed pastries.
One problem I always had with VSCode, is that it seems to fill up its autocomplete suggestions with "near-string-matches" from files all over the project. The jetbrains tools are quite strict in that regard and won't propose random string matches that don't fit semantically.
That doesn't sound right. clangd should (and does) only suggest semantically valid suggestions. It's also much faster than the CLion's own C++ engine, though that might change with CLion Nova.