You can obtain the information in either of the following ways:
To view information about all running processes, run the hdc shell command to enter the CLI of the device, and then run the ps -ef command.
import { process } from '@kit.ArkTS';
let pid = process.pid;