PID: For the process Identifier, PID is the identity of the processes, the program a running system will automatically assign to the process a unique PID. After the process aborts the PID is reclaimed by the system, may be continued to assign to the new running program, but in the Android system generally does not have the lost process ID reassigned to the new process, the newly generated process number is generally larger than all the process number before the production.
UID: The general understanding of user Identifier,uid in Linux is the ID of users, indicating which user ran the program, mainly for the management of permissions. And in Android is different, because Android is a single user system, the UID is given a new mission, data sharing, in order to achieve data sharing, Android for each application almost all assigned a different UID, unlike traditional Linux, Each user has the same UID assigned to it. (This, of course, indicates a problem that Android can only be a single-user system, which was castrated by their engineers at the beginning of the design), making it a tool for data sharing.
So in Android, the PID, and UID are used to identify the identity of the application, but the UID is for different programs to use the shared data.
In Android to share data through the UID can only be configured in the program A, a, menifest configuration, as follows:
<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"
Package= "COM.PERSEUS.A"
Android:versioncode= "1"
Android:versionname= "1.0"
Android:shareduserid= "Com.share"
>
<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"
Package= "com.perseus.b"
Android:versioncode= "1"
Android:versionname= "1.0"
Android:shareduserid= "Com.share"
>
This allows us to access the data in B by jumping activity in the a program.
In this case you may have doubts, if let other development this know our shareuserid know our ID, then our data is not exposed, rest assured that Google will not make such a low-level error, we want to make different programs can access each other, but also need to have the same signature, Each company or developer's signature is unique, so we don't have to worry about it, the other two can access, don't forget the permissions
The role and difference of UID and PID in ANDROID