Friday, 11 October 2013

How to use C Programming Under Linux


Before you start: To learn how to compile a c programme in C click here or click here

Friends today we start linux first programme "process.c" by understanding some linux feature such as Process ID.
In Linux each running task is called 'process', and as we know today we live in the environment where modern OSs like Window ,mac and Linux perform several tasks simultaneously.Hence these OSs are called Multitasking OSs so in these OSs even a single programme can have more than one process .
Kernel assigns each process running in memory a unique ID to distinguish it from other running process known as PID or process ID.
We discuss later about Multiple Process or Multitasking . Today we start by making a program that print PID of a running process.

int main()
printf("Hello this is our Linux First Programme\n");
printf("PID of running process=%d \n",getpid());
return 0;


root@bt:~/Desktop# gcc Process.c -o Process
root@bt:~/Desktop# ./Process
Hello this is our Linux First Programme
PID of running process=5181
Process in c
Above image is the output of previous program

 To learn more in C click here

No comments:

Post a Comment