Conversation

@drewdevault
[idiot enduser ie "me"] Yeah but it really saved my bacon so many times... since I don't get what you mean - can you write something about HOW its a mess. Would be relevant for me to learn since I've always kinda liked it but lack the skill to understand its underpinning?

0
0
0

@drewdevault No no you don't understand just HOW thick I am :D
(for me its always been a way to use something even if the graphical bits and bobs don't work or crash)
Can you simplify it even more? (as some kind of repayment I can explain at some point why art history as a field is relevant, and fun, AND give examples of why that is that will have you interested in the end... eh? eh?)

0
0
0

@drewdevault yes, just tested with:

sleep 2 | sleep 40 | sleep 60

resulting in:

PID PGID COMMAND
23450 23450 sleep 2
23451 23450 sleep 40
23452 23450 sleep 60

after 2 seconds the remaining sleep have a PGID of the (terminated) sleep 2:

PID PGID COMMAND
23451 23450 sleep 40
23452 23450 sleep 60

but I can still:

kill -INT -23450

to kill these two sleeps.

So it doesn't seem to be important that it's a PID of some specific process; might be just an implementation detail leaked...

1
0
0

@drewdevault Ah and I just went to read the POSIX manpages and I can "guess" (1)...

There is a constraint on setpgid(pid, pgid);
either pid == pgid (to create a new process group);
or pgid is a valid existing PGID (to join that group).

So this makes the PGID unique because the PID itself is unique.

Remaining question is: what happens if a new PID just happens to match the PGID of a (presumably very old) process group because leader died & PID is reused? Can't really test that though.

0
0
0

Matěj Cepl 🇪🇺 🇨🇿 🇺🇦

Edited 1 year ago

@drewdevault Could be there any correlation with xterm’s README starting with words “Abandon All Hope, Ye Who Enter Here”? Wasn’t it developed by the same people?

0
0
0
@drewdevault Yep, tty's are historical mess. For example ctrl-J and such are not available, because of the way its designed. But I don't believe it is going to be fixed anytime soon, because it works well enough.
0
0
0
these things are defined in posix:
1 - process group leader is the signal target, and determines session membership
2 - if the process group leader exits, nothing much happens UNLESS that exit orphans the group (session-wise), in which case the kernel is supposed sighup+sigcont that group
3 - I have no idea, postix speaketh not
0
0
0

@drewdevault first_time.gif

Yeah, ttys are hands down the *worst* parts of Unix, design- and implementation-wise. It never meshed well with the rest of the API, it's both cumbersome to use and a pile of hacks inside.

Since I like questioning interfaces and designing better systems, I should probably wonder how I would have done it, what a clean terminal system would look like. But so far I couldn't be bothered, it's just too deep in the kernel and too messy, and as long as I'm server-side I can almost pretend ttys don't exist.

0
0
0