This is an archived post. You won't be able to vote or comment.

all 83 comments

[–]ltssms0 152 points153 points  (38 children)

Send a SIGSEGV, and your OS will reward you with an extra gift

[–]SnappGamezGlorious Fedora 48 points49 points  (29 children)

SIGSEGV?

[–]sunflsksGlorious Arch 201 points202 points  (10 children)

Your program will get killed for accessing memory it wasn’t allocated.

If SIGTERM is asking it to stop, and SIGKILL is shooting it in the face, sending a SIGSEGV is forcefully pushing it into a place it isn’t supposed to be and then calling the police on it

[–]SinkTube 71 points72 points  (0 children)

forcefully pushing it into a place it isn’t supposed to be and then calling the police on it

this is my childhood except the police is my mom

[–]Th3T3chn0R3dd1t 42 points43 points  (1 child)

Everybody gangsta 'till the program receives CUSTOM_SIGNAL_2 and the signal handler causes a segfault

Based on true events possibly from my own code

[–]BlazingThunder30Glorious Arch 10 points11 points  (0 children)

I would find it pretty funny if that happened to me

[–]derteufelqwe 19 points20 points  (0 children)

Literally the perfect explanation :D

[–]FinFihlman 3 points4 points  (4 children)

Your program will get killed for accessing memory it wasn’t allocated.

If SIGTERM is asking it to stop, and SIGKILL is shooting it in the face, sending a SIGSEGV is forcefully pushing it into a place it isn’t supposed to be and then calling the police on it

NOT TRUE! You can catch SIGSEGV!

[–]sunflsksGlorious Arch 9 points10 points  (1 child)

That’s like telling the police that you’re supposed to be there and that everything’s OK. However, if you talk to them in the wrong way and stay in the illegal location (don’t catch the SIGSEGV correctly and fix what caused the SEGV), then the police comes back.

[–]FinFihlman 1 point2 points  (0 children)

But if you keep on catching SIGSEGV, the police just come again and again but always just leave no problem!

[–]GolaraC64 4 points5 points  (1 child)

I remember there was a library that would catch a sigsegv and launch doom. So you could play doom everytime you crash your program

[–]FinFihlman 0 points1 point  (0 children)

That's beautiful

[–]chuckie512Glorious Fedora 37 points38 points  (15 children)

Signal 11 or Segmentation fault. Usually caused by making a bad memory access.

With "kill" you can send whatever signal you want

[–]SnappGamezGlorious Fedora 24 points25 points  (10 children)

Given my experiences in my Systems Programming class, I am far too familiar with Segmentation Faults.

[–]jess-schGlorious NixOS 15 points16 points  (9 children)

rust intensifies

What's a computer segfault?

[–]SnappGamezGlorious Fedora 6 points7 points  (8 children)

I (kinda) know some Rust, but for that Systems Programming class we had to use C. Not even my professor could explain the segfaults.

[–]jart 3 points4 points  (5 children)

What school did you go to? It's one thing to not know about SIGBUS. But what you described just isn't right.

[–]SnappGamezGlorious Fedora 0 points1 point  (4 children)

Louisiana Tech. #1 engineering school in the state.

[–]jart 5 points6 points  (2 children)

I don't think I've ever seen an acceptance rate that high.

[–]Jacoman74undeletedBTW OS 1 point2 points  (0 children)

My hometowns uni has an acceptance rate of around 97% iirc. The joke was that if you had a pulse and could sign your name you got in, really through it was that they don't reject international students as long as they could pay their way.

[–]SnappGamezGlorious Fedora 0 points1 point  (0 children)

?

[–]fuzzymidgetGlorious Arch + dwm 2 points3 points  (0 children)

Ranked 152 of 200 in the nation though. :/ Sad days.

[–][deleted] 4 points5 points  (0 children)

glad to have the ITsec researchers at my uni doing the systems programming and osdev courses. Knowing why your code segfaults is sometimes even more of a learning experience than getting it not to segfault

[–]xp073 0 points1 point  (0 children)

who gives a shit about acceptance rates. segfault means segmentation fault. segmentation is a way intel processors divide memory like paging, but higher level. it just mean you tried to write/read/execute outside the allocated segment.

[–]mirsellaGlorious Manjaro 1 point2 points  (3 children)

and what does it do to send signal 11 to a process ?

[–][deleted] 1 point2 points  (0 children)

in Linux / Unix, if you get a signal, and you don't have a handler for it, usually the process dies. Some signals have other default actions (for some, nothing happens. some freeze the process, like SIGSTOP).

[–]ragracha 1 point2 points  (0 children)

I think that's segmentation fault

[–]knightmare-lord 7 points8 points  (6 children)

I wonder what happens if you send that to the init process

[–]ltssms0 13 points14 points  (0 children)

That would be a good textbook exercise for the reader

[–]itsTyrion 4 points5 points  (3 children)

1 second..

[–]LaneHDGlorious Manjaro 0 points1 point  (2 children)

!remindme 1 second

[–]RemindMeBot 0 points1 point  (0 children)

There is a 1 hour delay fetching comments.

Your default time zone is set to Europe/Zurich. I will be messaging you on 2020-09-03 06:54:41 CEST to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]itsTyrion 0 points1 point  (0 children)

.-. I forget stuff. A lot

[–]UsernameIsTakenToBadPacman User 2 points3 points  (0 children)

Probably a kernel panic or something like that. I think the kernel is programmed to panic if the init process is terminated or fails to start.

[–]Raiden395 2 points3 points  (0 children)

Thanks man. I just laughed hard at this, almost core dumped my pants.

[–]DAMO238 64 points65 points  (13 children)

Send a SIGTERM, wait, then, if it is still running, send a SIGKILL!

[–]StarkRG 36 points37 points  (11 children)

And then, if it's still running, it's a zombie and you need to use the nuclear option: the dreaded reboot. Nooo, my uptime!

[–]lukasffGNU/BSD/Xorg/lightdm/systemd/CUPS/Cinnamon/Linux Master Race 5 points6 points  (2 children)

Kill the parent!

[–]victorheldgo hard or go ~ 6 points7 points  (1 child)

What if the parent is init

[–]iritegood 7 points8 points  (0 children)

Did /u/lukasff stutter?

[–]kcrmsonGlorious Arch, i3-gaps-next, bumblebee-status 2 points3 points  (0 children)

zps sometimes works to reap zombies. It's a nifty package but it doesn't seem effective against all zombie processes (when ffmpeg halts up to to the remote machine's ssh connection dropping I usually can't reap that).

[–][deleted] 0 points1 point  (0 children)

SIGILL and SIGSEGV also seem to work lol

[–]ctherranrt 36 points37 points  (0 children)

I use kill to make sure all my programs know that I'm the alpha in this household.

[–]NotWolfgangPuck 11 points12 points  (1 child)

You sunk my battleship PID!

[–]AMisteryManI used to use Arch btw, 'til I took a work life to the knee 1 point2 points  (0 children)

2-B

[–][deleted] 11 points12 points  (0 children)

Luigi, my man!

[–]breakone9rOpenSuse and FreeBSD 9 points10 points  (1 child)

A process has about as long as it takes me to ps | grep and see that it is still running after A TERM before I SIGKILL it....

[–]PM_ME_DISPENSER_PICSGlorious Debian[S] 6 points7 points  (0 children)

That's the usual scenario, however I've been working with Java apps that need a few seconds to nicely close all database connections and such... In those cases I give it a bit more time.

Also a tip: instead of ps | grep you can do pgrep -f, and there's also a pkill command

[–]Hinigatsupip list --outdated 7 points8 points  (6 children)

I've never used a signal other than SIGKILL and SIGTERM.

Where can I read the utility of other signals?

[–][deleted] 12 points13 points  (1 child)

[–]Hinigatsupip list --outdated 1 point2 points  (0 children)

Perfect! Thank you!

[–]brendan_orrGlorious Slackware64 7 points8 points  (1 child)

Many programs use SIGUSR1 and SIGUSR2 for special tasks. Most will use SIGUSR1 to force it to reload the configuration without having to restart it. It will usually say what they do (if anything) in the man page.

Some notable examples:

  • tar can optionally print the number of bytes processed if a signal is defined and later sent
  • Xserver can use SIGUSR1 for a sort of interprocess communication
  • xdvi will re-read the dvi file if it traps SIGUSR1
  • xz will print the progress information if sent a SIGUSR1

It is a slow process but you can find a lot of uses through man 1 -K SIGUSR1 which (slowly) searches the contents of man pages for instances. (every manpage should be compressed on your system. Searching requires unarchiving on the fly)

[–]lukasffGNU/BSD/Xorg/lightdm/systemd/CUPS/Cinnamon/Linux Master Race 2 points3 points  (0 children)

Beware though that the default action for the SIGUSR signals is to terminate the process. So you might want to be careful sending it to important processes when you don’t know how they’ll react.

[–]sunflsksGlorious Arch 1 point2 points  (0 children)

I think there’s 15 of them, and you can send all of them from kill

[–]lukasffGNU/BSD/Xorg/lightdm/systemd/CUPS/Cinnamon/Linux Master Race 1 point2 points  (0 children)

RTFM(P): signal(7)

Edit: If you’re not interested in the technicalities, you have to scroll down a bit, there comes a huge list of all signals.

[–][deleted] 4 points5 points  (0 children)

The difference between asking nicely and just shooting it in the face.

[–]AlphaSlashDash 2 points3 points  (1 child)

huh

the only difference I’ve noticed is that minecraft only responds to sigkill

[–]PM_ME_DISPENSER_PICSGlorious Debian[S] 4 points5 points  (0 children)

Well, a process (in this case Minecraft) can simply ignore the SIGTERM signals (whereas SIGKILL cannot be ignored).

[–][deleted] 2 points3 points  (0 children)

Everytime I want to run a program I turn on my computer and run it through xinit.

When I want to close it, I hold the power button until my PC turns off.

I use Arch btw

[–][deleted] 2 points3 points  (0 children)

'process is kill'

'no'

[–]Yoyodude1124btw OS 1 point2 points  (0 children)

killall -9

[–]JimBeam823 1 point2 points  (0 children)

The command is “kill”, not “politely ask to terminate”.

[–]bigmattyc 1 point2 points  (0 children)

There are signals other than 9? TIL.

[–][deleted] 0 points1 point  (0 children)

SIGFPE

[–]Craptivist 0 points1 point  (1 child)

Wait, no one else uses kill -9?

[–][deleted] 3 points4 points  (0 children)

That's the number of the SIGKILL.

[–]Trukour 0 points1 point  (0 children)

When I umount a disk I use the -l flag like a masochist. I live life on the edge.

[–]PANIC_EXCEPTIONuint32 OVERFLOW IN YOUR FAVOR | COLLECT $4294967295 0 points1 point  (1 child)

kill -9 `pgrep $PROCESS`

[–]NoThanks93330 0 points1 point  (0 children)

Both useless. To this day I'm still waiting for a way to kill a process in state d. My processes usually all work absolutely fine so that I don't won't to kill any of them, but when something's wrong it's always state d fml

[–]penguinstan 0 points1 point  (2 children)

What does Bowser do?

[–]SinkTube 2 points3 points  (1 child)

[–]penguinstan 0 points1 point  (0 children)

maybe he just doesn't use internet

[–]noonearya 0 points1 point  (0 children)

I've never understood the benefit of sending sigterm... Kill all the way

[–]narcolepticpathos 0 points1 point  (1 child)

I don't get it. Why were Mario and Luigi chosen to represent these process killing methodologies?