Code to illustrate threads