There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores.
On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar <[email protected]>wrote: > oh yes, > gud one > > > On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki <[email protected]>wrote: > >> vishal@ubuntu:~/progs/c\ 12:11:53 PM >$ cat fork.c >> #include <stdio.h> >> #include <stdlib.h> >> >> int main() >> { >> if (fork()) { >> printf("hello "); >> } else { >> printf("world\n"); >> } >> return 0; >> } >> vishal@ubuntu:~/progs/c\ 12:11:56 PM >$ gcc fork.c >> vishal@ubuntu:~/progs/c\ 12:12:06 PM >$ ./a.out >> hello world >> >> >> On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar >> <[email protected]> wrote: >> > Hi Vishal, >> > >> > Can you show us how it be done with fork? >> > >> > On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki <[email protected]> >> > wrote: >> >> >> >> can use fork() also.. >> >> >> >> On Fri, Jun 3, 2011 at 11:57 AM, anand karthik >> >> <[email protected]> wrote: >> >> > (!printf("Hello")) >> >> > >> >> > On Jun 3, 2011 11:52 AM, "Arpit Mittal" <[email protected]> >> wrote: >> >> >> Please help me in this question. >> >> >> >> >> >> What's the "condition" so that the following code prints both >> >> >> HelloWorld ! >> >> >> >> >> >> if "condition" >> >> >> printf ("Hello"); >> >> >> else >> >> >> printf("World"); >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> -Arpit Mittal >> >> >> 6th Semester, >> >> >> Indian Institute of Information Technology,Allahabad >> >> >> Email : [email protected] >> >> >> [email protected] >> >> >> Contact : +91-8853049787 >> >> >> >> >> >> Let every man be respected as an individual and no man idolized. >> >> >> >> >> >> -- >> >> >> You received this message because you are subscribed to the Google >> >> >> Groups >> >> >> "Algorithm Geeks" group. >> >> >> To post to this group, send email to [email protected]. >> >> >> To unsubscribe from this group, send email to >> >> >> [email protected]. >> >> >> For more options, visit this group at >> >> >> http://groups.google.com/group/algogeeks?hl=en. >> >> >> >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups >> >> > "Algorithm Geeks" group. >> >> > To post to this group, send email to [email protected]. >> >> > To unsubscribe from this group, send email to >> >> > [email protected]. >> >> > For more options, visit this group at >> >> > http://groups.google.com/group/algogeeks?hl=en. >> >> > >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Algorithm Geeks" group. >> >> To post to this group, send email to [email protected]. >> >> To unsubscribe from this group, send email to >> >> [email protected]. >> >> For more options, visit this group at >> >> http://groups.google.com/group/algogeeks?hl=en. >> >> >> > >> > >> > >> > -- >> > Cheers >> > Naveen Kumar >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Cheers > Naveen Kumar > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards, Shachindra A C -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
