lab4 Process
  • Introduction
  • Knowing about process
    • Checking System Process
    • Process Identification
  • Let's Fork! Process Creation
    • Background of Process Creation
    • fork system call
    • Distinguish Parent and Child Process
    • Exercises
  • Process Execution
    • First exec example
    • Environment Variables
    • exec Family
    • exec Family: execlp
    • exec Family: execle
    • exec Family: execv
    • exec Family: execvp
    • exec Family: execve
    • exec error handling
  • Wait!
    • Problem 1: Without Wait?
    • Sleep
    • Problem 2: Zombies!
    • Wait System Call
    • waitpid
Powered by GitBook
On this page

Was this helpful?

  1. Knowing about process

Process Identification

In the system, there are lots of processes. We can identify one process uniquely by its Process ID or PID.

We have a special system call getpid() to retrieve the PID of the current process.

/* GettingStarted/getpid.c */
#include <stdio.h>
#include <unistd.h>

int main(int argc,char *argv[])
{
    printf("My PID is %d\n",getpid());
}

You can run multiple time to check the pid changes!

PreviousChecking System ProcessNextLet's Fork! Process Creation

Last updated 5 years ago

Was this helpful?