previous: >>108032139#define __NR_shmat 30https://man7.org/linux/man-pages/man2/shmat.2.htmlwow, this guy's got quite the extensive example in the manpage. that's always really nice, though. i'm one of those people who learns best by example, so this sort of thing definitely helps me a lot to understandon a slightly unrelated note, these syscalls have convinced me: in the future, i am going to group strongly related syscalls into a single day. keeps things from getting too boring, and it leaves open some room for cool newer syscalls at the end of the year. if anyone feels strongly that i shouldn't do this, well, speak now or forever hold your peacerelevant resources: man manman syscallshttps://man7.org/linux/man-pages/https://linux.die.net/man/https://elixir.bootlin.com/linux/https://elixir.bootlin.com/musl/https://elixir.bootlin.com/glibc/
#define __NR_shmat 30
man man
man syscalls
>coding thread on a nocoder board>filled with 0 nocoder postslma\0
I had some basic awareness that shm is a thing that exists but I've never seen it in the wildSo shmid is some kind of system-wide unique integer that identifies a shared memory region? And any process that knows the integer and has access to it can attach to it and join in on the fun?Feels weird to have such a global namespace that's completely decoupled from the filesystem, usually they try to cram it in there somehowI would post more considered sophisticated thoughts but the thread is about to fall off the catalog
>>108039975He's going through the syscalls in order, and we've in a run of really boring ones. There isn't much to say about shmat.At least we'll hit some interesting ones next week.>in the future, i am going to group strongly related syscalls into a single dayPlease and thank you.
>>108032139what do you dislike about threads? especially asynchronous operations can be quite nice.>>108042021well, shm is a fairly old concept and API, going back to early ATT Unix versions. The only time I've come across them in the wild is in sumatra pdf, although I don't remember the context.The only time I've ever used shm (be it older ATT or more recent POSIX) was in my uni OS class....
>>108044084>what do you dislike about threads?i don't like the implicitly shared writable memory. too many opportunities for race conditions, inefficiencies from mutexes, etc. i much prefer fork-like logic, with COW semantics and dedicated a shared memory scheme whenever it's for some reason absolutely necessary to have multiple processes operating on the same memory simultaneously>especially asynchronous operations can be quite nice.totally fine with async logic. so threads that only operate within their own thread-local storage i would begrudgingly accept
bampu
ive ever used this shit to speed up taking screenshots with X11
>>108039753Thanks ChatGPT but nobody asked for this
>>108039753>speak now or forever hold your peaceGood idea, specially since some are so similar that it's good to compare them to each other. Just don't do more than 2 or 3 at a time
>>108045013I see. It's a trade-off, as with everything. Having a request handler thread and threads that work is delegated to is a pretty good schema.Also, I've only rarely seen multiple threads/processes working on genuinely the same memory, unless it's like consumer/producer. Normally a memory region is sectioned off into several sub-regions, and those are delegated to the threads.oh, and to answer your question from the OP.yeah, otherwise there'll be very little discussion to be had on some days
>>108047537i will try to keep them to a minimum>>108048012>Also, I've only rarely seen multiple threads/processes working on genuinely the same memory, unless it's like consumer/producer.depending on what libraries you're working with, it can (unfortunately) end up being pretty common