Tag Info

New answers tagged

0

I assume, that you don't have only 9 processes. You could use, eg: pgrep sched pgrep bdflush or ps -u root | grep sched ps -u root | grep bdflush


2

The child could send a signal to the parent. SIGUSR1 and SIGUSR2 exist for this kind of ad hoc situation and could be ideal here. Your application can find its parent's process id easily enough with the Java equivalent of getppid(), or as an alternative perhaps you could have the parent pass its own PID ($$) on the command line as an argument that your Java ...


23

A minus sign before the command name is a convention that login programs use to start login shells. A login program is a program where you typically type your password and that starts a session for you, such as login, sudo -i, su -, sshd, etc. A login shell is the initial shell of a text mode session. Conventionally, when a program invokes another program, ...


1

If you've over-committed memory, a lot of tmpfs may be on disk. You may need to page stuff in to process the shutdown. mlock() is likely to force a lot of the other memory to disk. As you indicate you are diskless, you are likely reading over the network. Run sar gathering all stats while the server is shutting down. (sar may not be installed by ...


5

You could do something like: netns=myns find -L /proc/[1-9]*/task/*/ns/net -samefile /run/netns/"$netns" | cut -d/ -f5 Or with zsh: print -l /proc/[1-9]*/task/*/ns/net(e:'[ $REPLY -ef /run/netns/$netns ]'::h:h:t) It checks the inode of the file which the /proc/*/task/*/ns/net symlink points to agains those of the files bind-mounted by ip netns add in ...


22

The "D" state is unkillable. A process can only be killed when it's in user space (its code is doing whatever is doing). When a system call is called (most commonly the issue are input-output operations), the kernel takes over until the system call returns. While in kernel mode, the process cannot be killed. Aborting kernel code is dangerous for the entire ...


2

I wrote a tool which returns the plain application name (e.g. 'Terminal', 'gedit' or 'SmartGit' which are the ones I tested). Most code is shamelessly stolen from @Harvey here. // gcc clipboard-owner.c -lX11 -o clipboard-owner #include <stdlib.h> #include <stdio.h> #include <string.h> #include <X11/Xlib.h> #include ...


8

On Linux, almost all processes (including servers and daemon programs) are started with a fork(2) (sometimes implemented in your standard C library using clone(2)) often followed by execve(2) syscall. The daemon(3) library function use these (and some few others) syscalls (listed in syscalls(2)....) The only exceptions are a few processes magically started ...


4

Linux has a feature called network namespaces which allow you to essentially have multiple network stacks on the same machine, and assign one to a program when running it. This is a feature typically used for containers, but you can also use it to accomplish what you want. The ip netns subcommands manage it. Creating a new network namespace with no access ...


-3

You could use a command line program called "proxychains" and try one of the following possibilities: Set it up that it uses... ...a proxy that does not exist? (I do not know if it will run it with an "invalid" proxy) ...a local proxy (like "tinyproxy", "squid", "privoxy",...) that limits access to the internet? (Just use ACLs) I have not tested it ...


0

The load average does not just cover processes using CPU time or waiting for it. It also covers those processes in uninterruptable sleep (which usually means waiting for disk I/O). Dividing by the number of CPUs would lead to some bizarre (and often useless) numbers. If you have a system with 4 cores and 7 processes waiting for a single disk, the load ...


1

You didn't say but I'm assuming this is for Linux. Even though you are looking for the historical reason for it being per CPU, your question indicates that you are still thinking of the load average in terms of CPU utilization instead of the kernel job queue that it really is. You can still see CPU utilization in programs like top if you want to see a % ...


2

In Linux, you can get this information from /proc/<pid>/mounts where <pid> is the ID of the process you are interested in. There is also: /proc/<pid>/mountinfo which contains additional information but it is in a different, non-/etc/mtab-compatible format.


1

The system needs to keep track of the current directory of all processes because otherwise processes couldn't use relative paths for anything (including for example file open or stat, and changing directories — what does chdir("..") mean if you don't track were the process currently sits?). There's also the matter that without tracking that info, the ...


1

If your distro uses systemd, you can switch to minimal systemd target: systemctl isolate emergency.target This will kill almost all applications, move your system to single-user root login mode. After this you execute: systemctl isolate graphical.target You will be brought back to X. This will accompish almost a reboot.


0

You can kill all processes by following command: kill -9 -1 From manpage:- $ man kill | sed -n '5,6p' ; man kill | awk 'NR>=38 && NR<=40' NAME kill - send a signal to a process EXAMPLES kill -9 -1 Kill all processes you can kill. This will kill all processes and you will be redirected to login screen.


2

More seriously, rather than the radical kill'ing, you can switch to maintenance mode (aka Single User): # as root: /sbin/init 1 Your system will switch to runlevel 1, dedicated to maintenance tasks. [Nearly] All processes will be [nicely] killed, all file systems unmounted and interactive login directed to the console (the console boot argument). To ...


1

If the magic SysRq key is enabled on your system, you can press Alt + Print Scrn/SysRq + E or execute echo e > /proc/sysrq-trigger to send SIGTERM to all processes except init (PID 1). You can also use Alt + Print Scrn/SysRq + I or echo i > /proc/sysrq-trigger to send SIGKILL instead.


2

You cannot do this. Whatever you do, there has to be at least one process running. Or rather, when you can do this, you will cause the kernel to dump core and panic. An immediate reboot will probably follow - or else nothing will happen at all until you power cycle your machine. There is kernel space and there is user space. The user space is propped up ...


1

Because kill %n will run the shell builtin, which will make sure stopped jobs are sent SIGCONT so that they can realize they've been killed. To achieve that with PIDs of stopped jobs, you need to: kill $pid (Or kill -TERM $pid if you want to make it explicit) and then kill -CONT $pid You don't need the -CONT if you go for the ultimate murder ...


5

You can't rely on this behavior across platforms, even for dd. POSIX doesn't specify a response to SIGUSR1, and indeed your dd process will die if you try it on OSX or BSD, or even sometimes on embedded Linux (Busybox). Using SIGUSR1 on dd in this way appears to be a GNU extension. In practice, on most desktop Linux systems you'll be able to do this. ...


1

One handy way is to use atop. In atop, you can type P to see per program statistics like this: PAUSED NPROCS SYSCPU USRCPU VSIZE RSIZE RDDSK WRDSK SNET MEM CMD 1/4 17 1.14s 8.06s 14.3G 2.7G ? ? ? 35% chrome 1 0.30s 0.30s 2.6G ...


0

Do you mean all processes started by some process (have the same parent PID)? If you have pgrep you can filter all the processes with the same parent ID: top -p $(pgrep -P 2069 -d,) If not you can filter all process ids through awk and use them with top -p: top -p $(ps -eo pid,ppid |awk '($2==2069){printf "%s%s",delim,$1; delim=","}') Change $2==2069 ...


3

Press Shift+Esc to bring up Chrome's task manager. Locate the line corresponding to the PID you want (click on the “Process ID” column header to sort by PID). Double-click the line to bring the tab to the foreground.


6

in chromium address bar type: about:memory. It will show process ID and memory consumption of each tab:


0

You can use qps. It shows the total usage of each process.              Reference qps man page


2

I'm unable to comment in direct comments, at StackExchange reputation 21. I just wanted to mention that the FreeBSD kernel does implement something like an I/O scheduler, namely gsched. Reviewing the manual page, it seems to be a device-specific IO scheduler. Personally, I think it's a nice keynote toward realtime applications of FreeBSD, and a great reason ...


2

You can chroot the software into a bind mount setup where these directories are mounted read-only. mkdir /foo mount --bind / /foo mount --rbind /dev /foo/dev mount --bind /proc /foo/proc mount --bind /run /foo/run mount -t tmpfs tmpfs /foo/tmp mount --bind /sys /foo/sys mount --bind /usr/bin /foo/usr/bin mount -o remount,ro /foo/usr/bin chroot /foo rpm … ...


0

I use Ubuntu 12.04, but I do not think the process will be different using other versions of Ubuntu. TeamViewer screen sharing is my choice to replace the "TOO BLURRED TO READ" Skype screen share. The window sizes are about the same on my screen, but I can now read the print whereas the Skype blur makes reading impossible. Please note that although ...


0

Seems like a rather pointless exercise. Target process not only may not have all rights necessary to switch credentials, it may have its uid/gid stored somewhere and actively used, so a surprise credential change may actually break things. There are various entities which know who owns them - files, sysv ipc. So you would need to /stop/ all target ...


1

Very interesting attempt. Actually, process's supplementary groups (defined in /etc/group) are set by setgroups system call. It requires CAP_SETGID privilege or being root. So you can do like this: # id uid=0(root) gid=0(root) groups=0(root) # gdb -q id Reading symbols from id...(no debugging symbols found)...done. (gdb) b getgroups Breakpoint 1 at ...


0

The normal way to do this is to let your program exit, and use a monitoring system to restart it. The init program offers such a monitoring system. There are many different init programs (SysVinit, BusyBox, Systemd, etc.), with completely different configuration mechanisms (always writing a configuration file, but the location and the syntax of the file ...


2

Make your client exec /proc/self/exe when it receives that paticular message. You don't need to know where the executable actually resides in the file system. And you can reuse main()'s argv to construct a new argument vector. #include <unistd.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char ...


1

If the client application is a Linux service, it can be restarted with this command: service <clientapp> restart or forced to reload its configuration: service <clientapp> reload service <clientapp> force-reload If, more likely, it's a custom application, it needs to have embedded in its code the feature to restart itself or reload ...


3

Yes, you are correct. In particular, this means that the child will inherit all variables from the parent process with the value they had at the moment of the fork. However, if at a later step one of the parent or the child modifies one of these variables, the modification will be local to this process: if the child modify a variable, the parent process ...



Top 50 recent answers are included