I am novice in process/task management.
I would like to schedule two tasks.
suppose,
fun1()
{
printf("It will be printed in every 1 min \n");
}
fun2()
{
printf("It will be printed in every 2 min \n");
}
main()
{
fun1();
fun2();
}
So how to schedule them, so that I will get my desired output.
I want it to run in Code::Blocks (Windows).
I want fun1 to run 1 min and fun2 to run every 2 mins.
If I can do it in two separate process also then tell me how can I do it.
Do I need to use semaphore, mutex and all?
Your example is trivial and can be scheduled without resorting to any OS provided scheduling or even OS timing services, however in general (for non-trivial requirements) in Windows, you would use multi-threading and allow the OS to perform the scheduling.
main()is already a thread, so you only need create one other. In its simplest form:See Creating Threads for a more complete treatment of threading in Win32. Be aware that the .Net framework also provides a simpler class based interface to threading.