Illustration of sleep system systm call in GNU/LINUX using a simple program

//download link for the file: http://www.slideshare.net/hackintoshrao/time2c-10761496
/* Hackintosh Rao , Codes for GNU/LINUX \m/ */
/*system calls used :sleep(int sec)         */
/*Sleep system call pauses the execution of instructions for specified no.of.seconds*/
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    int i;
    for(i=0;i<10;i++)
      printf(“\n\t\tWithout time delay”);
      sleep(2);
    printf(“\nWait and watch how the execution halts for 2 seconds each time when SLEEP is called”);
    sleep(2);
    printf(“\nLOADING”);
    for(i=0;i<10;i++)
     {
         printf(“\n# “);
         sleep(2) ;/*the argument for sleep system call is an integer duration in sec for which
                      you want the exection of the instructions to be put to pause */

     }
     exit(0);
}

Advertisements

2 thoughts on “Illustration of sleep system systm call in GNU/LINUX using a simple program

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s