Tag Info

Hot answers tagged

24

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, ...


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 ...


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 ...


6

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


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 ...


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. ...


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

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.


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 ...


2

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 ...


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 … ...


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 ...


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.


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 ...


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

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 % ...


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.


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.


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 ...


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 ...


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 ...



Only top voted, non community-wiki answers of a minimum length are eligible