[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1713598634119831.jpg (57 KB, 540x405)
57 KB
57 KB JPG
previous: >>108032139

#define __NR_shmat                30

https://man7.org/linux/man-pages/man2/shmat.2.html

wow, 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 understand
on 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 peace

relevant resources:
man man

man syscalls

https://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/
>>
>coding thread on a nocoder board
>filled with 0 nocoder posts
lma\0
>>
I had some basic awareness that shm is a thing that exists but I've never seen it in the wild
So 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 somehow
I would post more considered sophisticated thoughts but the thread is about to fall off the catalog
>>
File: syscalls.png (16 KB, 257x308)
16 KB
16 KB PNG
>>108039975
He'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 day
Please and thank you.
>>
>>108032139
what do you dislike about threads? especially asynchronous operations can be quite nice.
>>108042021
well, 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....
>>
File: 1769815198596201.jpg (27 KB, 340x296)
27 KB
27 KB JPG
>>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
>>
>>108039753
Thanks ChatGPT but nobody asked for this
>>
>>108039753
>speak now or forever hold your peace
Good 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
>>
>>108045013
I 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
>>
>>108047537
i 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



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.