What is the difference betwen wait() and delay()?

Questions by navac++

Showing Answers 1 - 10 of 10 Answers

Avaited

  • Mar 12th, 2006
 

wait() and delay() works same but are used on different platform . Wait(2) will wait for 2 second in unix/linux platform and delay(2000) will wait 2 second on dos/windows platform.

  Was this answer useful?  Yes

Wait() and delay() works same but works on different platforms. Wait(2) will wait processing fro 2 second on Linux/Unix while delay(2000) with wait for 2 second but on DOS or Windows.

so wait(2) on linux == delay(2000) on DOS

Delay() is under <dos.h> while one can directly use wait in his/her program.

  Was this answer useful?  Yes

sorry forks
by mistake i thought about sleep command instead of wait(). Actually Wait command is used under UNIX flavours system to wait for the completion of running process. like type on your shell prompt
 
$ sleep 500 | sleep 300 &
 
it will give prompt to user to do some works while in back ground sleep 300 process will work.
now type
 
wait <pid of sleep 300>
 
and command(i.e. shell ) will wait for the completion of sleep 300 process. pid of sleep 300 process will get automatically when you type first line.
As far as delay is concern it is right as i stated.

  Was this answer useful?  Yes

Munish

  • Apr 14th, 2006
 

wait is similar to sleep command. their is one major difference between the structure of sleep and delay in regard to coding. Delay is similar to executing infinite null statements till the time pases. but sleep causes CPU to wait till the time passes. so Delay will consume more processor than sleep.,

  Was this answer useful?  Yes

3bu1

  • Aug 21st, 2007
 

wait()....event triggered
delay()....time trigerred

  Was this answer useful?  Yes

yzesong

  • Aug 1st, 2009
 

In a proces which issues wait( ) will suspend itself until either a certain process terminated(wait(n), n is PID) or all process terminated (wait()). Delay is like pausing for a certain period of time, same as sleep( ).

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions