is it possible in c program to run two processes at the same time.For example i want to run a timer along with my application .The timer must be shown on the screen.Thanks in advance

is it possible in c program to run two processes at the same time.For example i want to run a timer along with my application .The timer must be shown on the screen.Thanks in advance

The short answers is yes with clarification as to what you mean by "same time". Do you mean multi-tasking where the processor appears to be running multiple processes at the same time or do you mean true "same time" where a multi-core processor is required?

With that divergence out of the way check out threads, they allow a single process(or single thread process) to spawn additional processes(or threads/light weight processes).

So yes its possible for a C program to run/spawn more than one process...

Here's a link for POSIX threads

http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

Edited 6 Years Ago by gerard4143: n/a

What i would like to do is,i want to run a quiz program where the users can see a countdown timer attached to the screen and at the same time should answer my questions.Can you guide me how to do this.Thank tou in advance

What i would like to do is,i want to run a quiz program where the users can see a countdown timer attached to the screen and at the same time should answer my questions.Can you guide me how to do this.Thank tou in advance

This sounds like a candidate for threading. The best thing to do is Google a few thread tutorials, these with some experimenting will determine if threads will work for your program....

This article has been dead for over six months. Start a new discussion instead.