Home  >  Article  >  Java  >  10 recommended articles about process ID

10 recommended articles about process ID

黄舟
黄舟Original
2017-06-15 14:25:501849browse

This article mainly introduces how Java obtains the current process ID and the process IDs of all Java processes. It has certain reference value. Interested friends can refer to it. The first is to obtain the Java process ID of the current Java running. This It is common on the Internet, that is, the Java program itself prints out the process ID: package com.test; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; public class Target { public static void main(String[] args) throws InterruptedException

1. How does Java get the current process ID and the process IDs of all Java processes

10 recommended articles about process ID

#Introduction: This article mainly introduces how Java obtains the current process ID and the process IDs of all Java processes. It has certain reference value. If you are interested, Friends, you can refer to

2. C/C++ small tool for traversing processes and process IDs

10 recommended articles about process ID

Introduction: When we write some destructive programs, we need to traverse the process and extract the ID

3. Linux--Terminal, job control, and daemon process

10 recommended articles about process ID

##Introduction: 1. Process group : is a collection of one or more processes. Typically, associated with the same job, various signals from the same terminal can be received. Each process has a unique process group ID. Each process group can have a leader process. The identity of the group leader process is that its process group ID is equal to its process ID. The group leader process can create a process group, create the processes in the group, and then terminate. As long as there is a process in a process group, the process group exists, regardless of whether the group leader process terminates.

4. The reasons why Linux zombie processes are generated and how to avoid them

10 recommended articles about process ID

Introduction: The purpose of setting the zombie state to a process is to maintain the information of the child process so that the parent process can obtain it at a later time. This information includes the child process's process ID, termination status, and resource utilization information (CPU time, memory usage, etc.). If a process terminates and its child processes are in the zombie state, the parent process ID of all its zombie child processes will be reset to 1 (init process). The init process that inherits these child processes will clean them up (the init process will wait for them, thereby removing the zombie state).

5. workerman notes-php creates daemon process

Introduction::workerman notes-php creates daemon process: data-id="1190000005056078" data-license="sa">Use function pcntl_fork();//Create a child process posix_setsid();//Set the current process as the process leader posix_getpid();//Get the process id example workerman Lieutenant General process/*** Run as deamon mode.** @throws Exception*/ protected static

6. Semaphore PHP obtains the incremental sequence ID through system semaphore locking method

Introduction : Semaphore: Semaphore PHP uses the system semaphore locking method to obtain the incremental sequence ID: After searching on the Internet, there are two methods but neither are very good: one is simply process ID + timestamp, or process ID + random It is simple to generate an approximate unique ID through numbers, but I don’t want to make do with it for those who pursue “perfection”. Besides, the process will last for a long time after Apache2, and the probability of collision between the generated IDs is still relatively high; the second idea It is through the auto-increment field of Mysql, which cannot be considered. Not to mention the low efficiency, there is no database at all in my design. Obtaining an incremental ID is a process: 1. Read the ID from a global storage 2. Give I

7. Get the incremental sequence ID through system semaphore locking under PHP_PHP tutorial

Introduction: Locking through system semaphore under PHP method to obtain the incremental sequence ID. After searching on the Internet, there are two methods, but neither of them are very good: one is to simply use process ID + timestamp, or process ID + random number to generate an approximate unique ID. Although it is simple, it is not suitable for people who pursue "perfection"

8. A good way to get the current progress of a loop in other pages

Introduction: Get a loop in other pages A good way to achieve the current progress may be that the title is a bit general, but the requirements are like this. There is a mass mailing function. Sometimes it may be sent to hundreds of customers in bulk, so it needs to be circulated hundreds of times. At the same time, there is also a page where you can see the progress of this sending in real time, and dynamically display the number of emails sent. The process ID is different every time you send an email. The processing logic of the current display page is to regularly query the total number of IDs belonging to this process in the mail table through ajax, and then return to the page for display. This feels like

9. Get the incremental sequence ID through system semaphore locking under PHP

Introduction: PHP Next, obtain the incremental sequence ID through system semaphore locking. After searching on the Internet, there are two methods, but neither of them are very good: one is to simply use process ID + timestamp, or process ID + random number to generate an approximate unique ID. Although it is simple, it is not suitable for people who pursue "perfection"

10. php code exec("kill $pid"$op,$returns) cannot kill the process under the linux virtual machine

Introduction: The php code exec("kill $pid",$op,$returns) cannot kill the process under the Linux virtual machine. As the title says, I wrote the php code exec("kill $pid",$op under Linux ,$returns), kill the process through pid. After execution, the return value is always "1", which means that the execution has been unsuccessful, and the process ID is still there after execution. I have given the maximum

to the file that executes the kill call [Related Q&A recommendation]:

How to kill a process in Linux based on part of the process name

shell - How to batch query the status of multiple processes in Linux

linux - bash remote ssh to get the process ID and kill

How to release a port that is occupied in Linux?

linux - mongodb WARNING rlimit too low?

The above is the detailed content of 10 recommended articles about process ID. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn