Skip to content

shubhanshu02/async-in-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Async-in-c

Asynchronised Behaviour in C using Threading

Note: This program uses POSIX threads.

Instruction to measure performance

The file async.c contains an example to implement async behaviour in C. Both synchronous and asynchronous executions are shown in this piece of code.

By default, synchronous execution is enabled. To emulate the execution of a heavy task, the program sleeps for two seconds.

Synchronous Behaviour

  1. Compile the program with POSIX thread flag.
gcc async.c -lpthread
  1. Run the program. The order of execution of functions will be printed as the output.
./a.out
  1. Use the time command to check the speed of the execution in terms of seconds.
time ./a.out

Asynchronous Behaviour

  1. Comment the lines 90 and 91.
  2. Uncomment the lines 94 and 95.
  3. Follow the steps in the above section (Synchronous Behavior).

About

Asynchronised Behaviour in C using Threading

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages