pid

Kill a java process (in linux) by process name instead of PID

丶灬走出姿态 提交于 2019-11-30 11:46:14
While configuring/installing Hadoop cluster we often need to kill a Java Process/Daemon. We see Java Processes/Daemons running with jps command. Usually we kill a Java process with its PID. E.g. kill -9 112224 It is little bit difficult to type the PID. Is there a way to kill the process by its name? In a single command? Here is the command to kill the Java process by is Process Name instead of its ProcessID. kill `jps | grep "DataNode" | cut -d " " -f 1` Let me explain more, about the benefit of this command. Lets say you are working with Hadoop cluster. Its often required that you check java

Using -XX:HeapDumpPath option but want to integrate the process id

╄→尐↘猪︶ㄣ 提交于 2019-11-30 11:26:03
When using -XX:+HeapDumpOnOutOfMemoryError the JVM will not overwrite the heap dump if there is already a dump file under the specified path. I want to be able to have multiple heap dumps in a non-default location, and was planning on using the pid in the heap dump path in order to allow that. However, when I tried to specify the argument like so: -XX:HeapDumpPath=some/heapdump/path/heapdump-%p.hprof And then created a heap dump, I got %p and not the actual pid in the file name. However, the use of %p seems to work with the -XX:OnOutOfMemoryError option. Is there some other syntax that I'm

How to monitor an external process for events by its PID in C?

喜你入骨 提交于 2019-11-30 11:06:48
Is there any library which's got some function the allows one to monitor an external process for events by its pid_t ? I mean, monitoring whether an external process has exited, or whether it has created one or more child processes (with fork ), or whether it has become another executable image (via an exec or posix_spawn function family call) or whether a Unix signal was delivered to it. EDIT I need something that does not interfere with the execution of the program that is being monitored. So, I'm not supposed to use ptrace , since it stops the process which is being monitored when it emits

Android中UID和PID的作用和区别

此生再无相见时 提交于 2019-11-30 10:35:08
PID:为Process Identifier, PID就是各进程的身份标识,程序一运行系统就会自动分配给进程一个独一无二的PID。进程中止后PID被系统回收,可能会被继续分配给新运行的程序,但是在android系统中一般不会把已经kill掉的进程ID重新分配给新的进程,新产生进程的进程号,一般比产生之前所有的进程号都要大。 UID:一般理解为User Identifier,UID在linux中就是用户的ID,表明时哪个用户运行了这个程序,主要用于权限的管理。而在android 中又有所不同,因为android为单用户系统,这时UID 便被赋予了新的使命,数据共享,为了实现数据共享,android为每个应用几乎都分配了不同的UID,不像传统的linux,每个用户相同就为之分配相同的UID。(当然这也就表明了一个问题,android只能时单用户系统,在设计之初就被他们的工程师给阉割了多用户),使之成了数据共享的工具。 因此在android中PID,和UID都是用来识别应用程序的身份的,但UID是为了不同的程序来使用共享的数据。 在android 中要通过UID共享数据只需在程序a,b中的menifest配置即可,具体如下: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com

jdk自带分析vm工具(jdk 5.0以上版本)

纵然是瞬间 提交于 2019-11-30 09:30:39
一、概述 SUN 的JDK中的几个工具,非常好用。秉承着有免费,不用商用的原则。以下简单介绍一下这几种工具。(注:本文章下的所有工具都存在JDK5.0以上版本的工具集里,同javac一样,不须特意安装) 。 我一共找到以下四个工具:重点看看jconsole和jmap。 Java代码 jps 与unix上的ps类似,用来显示本地的java进程,可以查看本地运行着几个java程序,并显示他们的进程号。 jstat 一个极强的监视VM内存工具。可以用来监视VM内存内的各种堆和非堆的大小及其内存使用量。 jmap 打印出某个java进程(使用pid)内存内的,所有‘对象’的情况(如:产生那些对象,及其数量)。 4.console 一个java GUI监视工具,可以以图表化的形式显示各种数据。并可通过远程连接监视远程的服务器VM。 二、 使用介绍: 1、jps :我想很多人都是用过unix系统里的ps命令,这个命令主要是用来显示当前系统的进程情况,有哪些进程,及其 id。 jps 也是一样,它的作用是显示当前系统的java进程情况,及其id号。我们可以通过它来查看我们到底启动了几个java进程(因为每一个java程序都会独 占一个java虚拟机实例),和他们的进程号(为下面几个程序做准备),并可通过opt来查看这些进程的详细启动参数。 使用方法:在当前命令行下打 jps(需要JAVA

How to get child PID in C?

∥☆過路亽.° 提交于 2019-11-30 08:26:06
I'm creating child processes in a for -loop. Inside the child process, I can retrieve the child PID with getpid() . However, for some reason when I try to store the value of getpid() into a variable declared by the parent process, the change is nullified when I check for it in the parent process. I'm assuming this has to do with some sort of process variable scope. Not really familiar with C, so can't be too sure. Anyhow what is a way of storing the result of getpid() of a child PID (when called from the child process) into a variable in the parent process? Or maybe another approach is storing

What is the maximum process Id on Windows?

跟風遠走 提交于 2019-11-30 07:55:19
问题 What is the maximum process id I can get by calling DWORD GetProcessId(HANDLE) or DWORD GetCurrentProcessId() ? It is not documented on the API's documentation page. 回答1: According to the Pushing the Limits of Windows: Processes and Threads blog post by Mark Russinovich number of processes is limited only by available memory. So theoretically maximum process id is near DWORD_MAX (pids are divisible on 4). 回答2: I couldn't find an official statement on it but since it's stored and returned as a

What is the correct printf specifier for printing pid_t

我的梦境 提交于 2019-11-30 07:45:06
问题 I'm currently using a explicit cast to long and using %ld for printing pid_t , is there a specifier such as %z for size_t for pid_t ? If not what the best way of printing pid_t ? 回答1: There's no such specifier. I think what you're doing is fine… you could use an even wider int type, but there's no implementation where pid_t is bigger than long and probably never will be. 回答2: With integer types lacking a matching format specifier as in the case of pid_t , yet with known sign-ness 1 , cast to

What is the PID in the host, of a process running inside a Docker container?

▼魔方 西西 提交于 2019-11-30 06:43:21
There are several processes running in a Docker container, their PIDs are isolated in the container namespace, is there a way to figure out what are their PIDs on the Docker host? For example there is an Apache web server running inside a Docker container, (I use Apache+PHP image from Docker Hub ), and the Apache, when it starts, creates more worker processes inside the container. Those worker processes are actually handling incoming requests. To view these processes I run pstree inside the docker container: # pstree -p 1 apache2(1)-+-apache2(8) |-apache2(9) |-apache2(10) |-apache2(11) |

Find the pid of a java process under Linux

若如初见. 提交于 2019-11-30 06:37:59
Hello I am using MPJ library in java program for Pagerank algorithm. I compile it by javac -cp .:$MPJ_HOME/lib/mpj.jar MpiPageRank.java and run by mpjrun.sh -np 2 MpiPageRank where -np is number of process Now i have to find its pid ps -ef|grep java like mpjrun.sh -np 2 MpiPageRank & sleep 2 ps -ef | grep java I get pnewaska 27866 27837 99 21:28 pts/45 00:00:09 java -cp /u/pnewaska/mpj-v0_38/lib/smpdev.jar:/u/pnewaska/mpj-v0_38/lib/xdev.jar:/u/pnewaska/mpj-v0_38/lib/mpjbuf.jar:/u/pnewaska/mpj-v0_38/lib/loader2.jar:/u/pnewaska/mpj-v0_38/lib/starter.jar:/u/pnewaska/mpj-v0_38/lib/mpiExp.jar