Hacker Newsnew | past | comments | ask | show | jobs | submit | deivid's commentslogin

Building postgres server as a library. Some early success, but initdb and in-process restarts are much harder than expected

Do you mind elaborating more about the use case? Postgres itself is heavily engineered around OS process boundaries for both correctness and resiliency.

I'm not sure it'll be a serious project, but the main goal is to use it in CI or dev, where setting up postgres is kind of a pain.

I got it to work already by setting up the global context in single-user mode (like postgres --single) and exposing bindings for SPI operations.

Yesterday night I got extensions working, but as this project builds as a static archive, the extensions also have to be part of the build. Both plpgsql and pgvector worked fine.

The bigger challenge is dealing with global state -- comparing the pre-start and post-shutdown state of the process memory, about 200 globals change state. Been slowly making progress to get restarts working


I've been writing on my blog for 9 years. Still feel the same blockers you do on every new post.

For me, the main motivation is that I enjoy reading other people's blogs, and hopefully my posts give someone ekse a similar enjoyment

I had a few attempts to lower the bar (tags for low effort, short and shitpost so far), but it feels like a crutch and hasn't worked long term for me.


These screens look amazing, but $1500-2500 is a bit much. Any other screens with this monichrome CRT style?


I've had this project idea in my list for a while, I even implemented thr software side (an option rom for the pci card) but the hardware side is quite difficult to get started. My plan was to get an FPGA with a hard pci core to do this, but I don't even know what to buy.

I got a cheap Tang Mega 238k but I never managed to even get the PCI examples working (and couldn't even adjust BAR settings)


Well it was released on Linux in 2007, so it's meant Kernel Virtual Machine for at least 18 years

See: https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine


KVM (as in the switch) was termed in 1995: https://en.wikipedia.org/wiki/KVM_switch


It certainly wasn't in common usage that early - at least not outside of linux circles. I don't really recall hearing it in this context before maybe the early 20's


Really nice post, some months ago I also wrote about linux boot, but a bit more focused on the IO side (what's on disk, how is it loaded), here: https://blog.davidv.dev/posts/booting-x86-64/


Oh wow! Combined with the explaination of iso files which can be a single file which can have things like fat and bzimage and rootfs etc. with the bootloader and combined with software like dd / gnome-disks and your article and the HN thread article, this finally makes me understand how Linux starts and how we can install things from https / internet and use software to fundamentally change the operating system

Its magic.

I was recently trying to build my own linux operating system and I felt so frustrated as to how to build an iso image from bzImage / linux kernel + initramfs but I was able to withstand its pain somehow and it took me a week to actually learn a lot more about the fundamentals of linux which are so fascinating.

Now, I was trying to do some mix and matching (imagine tinycorelinux initramfs and buildroot bzImage and merging them) and doing some other shenanigans.

Sometimes my computer kernel didn't work or the userspace didn't work in the vm and I guess now WHEN I AM WRITING THIS POST, I realized that it was because of the difference in 32 bit and 64 bit, I think I had 64 bit kernel and 32 bit userspace which had some issues

There were some different things as well, which had caused some issues which made me want to scratch my remaining hair but it was so worth it (maybe i used some llm assistance in the end as well), its all just makes sense now, I always wanted to learn how computers work from scratch, now I feel like I have a very basic idea on how things work and they are complex indeed :sob:

I was looking for a post like yours yesterday and so I am still glad I found it when the topic is still fresh.

I faced so many issues trying to build my own iso but I don't know if it was my skill issue which streched it to a week. But the whole process of building your own iso seems less daunting to me now knowing what it really is

I may have skill issues indeed but I fixed those, I feel like that there is a lot to learn from those errors that I missed but maybe that's also because they got too overwhelming. But I now know a path which works and some explainations of why they work. I feel more confident in my ability to make my own custom distro even, but my appreciation for linux grows so much.

Its just such a massive rabbit hole and most of linux is literally just "it just works", linux is amazing.


I am curious were the differntiation comes between linux, and other unix systems (bsd, etc ..).


Thanks! Nice to see it has plenty of diagrams.


This is amazing! I am also a little bit obsessed with fast-booting kvm for per-request isolation, and have managed to get Linux to pid1 in 3.6ms, I am starting to go a little insane because I don't know how to measure the rest of the CPU time (would love a flamegraph somehow) -- the ftrace data just... confuses me


C at least has const ptr. In go I've seen pointers mutated 7 levels down the callstack. And of course, the rest of the sphagetti depended on those side effects.

C is so limited that you would try to avoid mutation and even complex datastructures.

Go is "powerful" enough to let you shoot yourself much harder.

Go with `const` and NonNull<ptr> (call it a reference if you need) would be a much nicer language


you probably should set the serial port speed


Oh, I didn't realize -nographic was using a serial port. That's probably why it's slow!


It may default to 9600... tons of devices will fall back to that, given no other instruction


Yeah, that was my inference. It looked like about 9600.


FDroid owns the keys for any app submitted without reproducible builds. But I believe they would prefer 100% reproducible builds and to own no keys


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: