This task is to determine if there is only one instance of an application running. If the program discovers that an instance of it is already running, then it should display a message indicating that it is already running and exit.

open Sem
 
let () =
  let oflags = [Unix.O_CREAT;
                Unix.O_EXCL] in
  let sem = sem_open "MyUniqueName" ~oflags () in
  (* here the real code of the app *)
  Unix.sleep 20;
  (* end of the app *)
  sem_unlink "MyUniqueName";
  sem_close sem