We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

-1

ps -eaf | grep -i applicationname| grep -iv 'grep'| awk '{print "kill -9" " " $2}'|sh


0

It appears to be getting the command name from the main thread's name set by pthread_setname_np.


-2

My approach is similiar to @Łukasz D. Tulikowski's. Instead of using grep <application_name>; I have used grep "[a]pplication_name", which does not match with its own process command line. The square bracket expression is part of the grep's character class pattern matching. (Reference). You can use awk to a get first a column of ps output. ps -A | ...


2

child processes inherit all the file descriptors from their parents. When executing a command (like your sleep here assuming your shell doesn't have it builtin), only the file descriptors marked with the close-on-exec flag are closed, but shells never set that flag on stdout (fd 1). a pipe reader will only get an EOF when all the file descriptors pointing to ...


3

When I saw this question, I was pretty interested because I know I've seen getppid used before..but I couldn't remember where. So, I turned to one of the projects that I figured has probably used every Linux syscall and then some: systemd. One GitHub search later, and I found two uses that portray some more general use cases (there are a few other uses as ...


0

Most system calls (essentially those that put the process on a queue for a service) result in the kernel scheduler taking the next most urgent process and making it run. Complicated slightly for multi-core, and where processes can be allocated to specific cores or CPUs. Processor time is also allocated in maximum time slots, and at each clock tick the ...


1

I'm not certain what is the modern C++ way of doing it, but you might want to look into mlock(2) to disable swapping for memory pages. I'm also somewhat curious as to what happens if you rerun it immediately. I would expect the reserve call you use do not actually touch all memory pages (and thus do not force them to be actually allocated) - if that was the ...


-2

How this works? (scroll to the end for the original linux "scheduler proper") It is quite impossible to explain in simple words. Even difficult to define the terms you mention (process, thread, task, kernel/user). I know that the scheduler schedules different processes based on priority/time slicing. Time slicing on a monocore single CPU is how it ...


4

I suspect you were reading this or something very similar (https://elinux.org/Kernel_Timer_Systems): Timer Wheel, Jiffies and HZ (or, the way it was) The original kernel timer system (called the "timer wheel) was based on incrementing a kernel-internal value (jiffies) every timer interrupt. The timer interrupt becomes the default scheduling quantum, ...


-3

The TSC is a x86 register counting clock cycles - so the device can be the CPU, because the CPU knows it's frequency (more or less). With multicore and SMP this gives some problems. I guess that is what option acpi_pm as clocksource would be for. HPET (hpet) is an alternative. It was specified by Intel (and Microsoft) in 2004 for synchronizing multimedia "...


1

You can make a reasonable shortlist using: ps -ef | awk '$1 == "myUser" && $3 == 1' Maybe refine that by also filtering on other fields, like STIME not for your session startup, and TTY not ?, and CMD not starting with /usr/lib or /usr/bin or /lib. Put the list into a file for a final check, and then awk out column 2 | xargs | kill.


1

Kernel tasks which aren’t run “in process” (to service a system call, or an interrupt) are handled as separate processes themselves, and you can see them in ps’s output: root 2 0.0 0.0 0 0 ? S Sep16 0:02 [kthreadd] root 3 0.0 0.0 0 0 ? I< Sep16 0:00 [rcu_gp] root 4 0.0 0.0 0 ...


1

In general, parent processes are responsible for performing wait() on their children so that their children do not become zombies when they terminate. If the parent process terminates before the child, then there must be some process to play the parent's cleanup role, again, preventing the children from becoming zombies. By default, when a process ...


1

What bash script concept am I missing? Threads, maybe? Job control. You can start processes in the background and exercise fairly fine-grained control over them by knowing their process ID and exit status. To get a backgrounded command's PID, use the $! variable. To get a backgrounded command's exit status use wait() and provide its PID. Note, calls to ...


0

Another option for killing all descendants of the shell: jobs -p | xargs -n 1 pkill -P


0

A principal failing in your code is the use of time(). This returns a value in seconds, so your loop might last from 4 to 5 seconds. Instead you should use gettimeofday() which provides a microseconds field (though the resolution might be worse than that). You might also reduce variability by making your process a real-time process. Use chrt -f to run your ...


0

While the statements might operate at a constant number of clock cycles for each loop, there is no guarantee that they will have a constant clock time for execution. There are any number of other things which the kernel must address, using clock cycles which your loop will not have available. Updating the system clock, checking for other processes to run, ...


10

On some Unix-style systems (BSDs and macOS), CtrlT sends SIGINFO to the running process. Some commands handle this directly; otherwise, it’s handled by the kernel, and that’s what produces the output you’re seeing. SIGINFO on GNU Linux (Arch Linux) missing has more on the topic.


1

how can I get the process's info before it dies? 'ps' is the tool for a "snapshot". top for a live table. Both have complex man pages. I like ps axf which gives a tree structure. get Google Chrome Tabs precise PIDS? The other way round like this you mean? (part (branch) of ps axf output) \_ /usr/lib/firefox/firefox \_ /usr/lib/firefox/...


0

Not sure this is what you want, but start time and elapsed time can be found with ps command. ps -o 'comm,stime,etime' 1134 #1134 is your pid Other options for ps apply of course, like the -a option to show other than just the user's processes


Top 50 recent answers are included