Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix error message "Killed"

Tags:

c++

unix

I am working on a game of Hex in C++ on a Unix platform (Currently running c shell). The AI for my game takes less than a minute to decide on its move (I'm using a sort of Monte Carlo algorithm), and after a few steps, the program terminates on its own, merely printing "Killed" before returning to my command prompt. Does anyone understand what is causing this to happen, and have any suggestions as to how I might go about changing my code to fix it? If it helps at all, I am not using my system. I am connected to my school's server using SSH Secure Shell. I should also point out that I don't think its something wrong with my algorithm because it works as I expect it to until the crash, but it consistently crashes while deciding its 7th move.

like image 478
user2309865 Avatar asked Jun 05 '13 23:06

user2309865


People also ask

What does Killed mean in Linux?

This means the process has finished its tasks, so it chooses to terminate. involuntarily: when receiving a signal. This signal can be sent by another user, another process, or Linux itself.

What killed process?

In probability theory — specifically, in stochastic analysis — a killed process is a stochastic process that is forced to assume an undefined or "killed" state at some (possibly random) time.

In which log we can check if the running process is killed by kernel?

If the kernel killed a process (because the system ran out of memory), there will be a kernel log message. Check in /var/log/kern.

What is killed in C++?

The kill() function sends a signal to a process or process group specified by pid. The signal to be sent is specified by sig and is either 0 or one of the signals from the list in the <sys/signal. h> header file.


1 Answers

That's the out of memory manager that does that. Most likely you have some sort of memory leak. If you want to continue with the memory leak you can run a script like this in another session. Replace processname with the name of your binary.

#!/bin/bash
while true; do {
    pgrep -x "processname" | while read PID; do {
        echo -1000 > /proc/$PID/oom_score_adj; 
    } done;
} done;
like image 168
jbrahy Avatar answered Oct 03 '22 17:10

jbrahy