Originally posted by: Anand Pillai
Hi
Do we need multiple threads only for applications with
a GUI or for network applications that listen to ports
asynchronously ... How about a console application that
synchronizes two directory trees ? Does a thread that searches directories and another that copies out-of-date files make sense ?
Regards
Anand
ReplyOriginally posted by: xuefengsky
the title is the question
ReplyOriginally posted by: Nikhil alulkar
Vey goo explenation,
But can you add some code snippet and increase the glory ofexplenation.
Regards,
Nikhil alulkar
(Nasan Systems), India
Originally posted by: Hans Wedemeyer
Rob,
You wrote:-
-------
Actually, once a thread is running it will not be reempted until the end of it's quanta - regardless of whatever higher priority threads are waiting. The only exception to this is real-time priority threads waiting on hardware related events.
--------
Not to cause any arguments, but could you please give me a reference that supports your claim.
I was in agreement with the article until I read your comment, and I now need to know why you think it is wrong ! I hate holes in my knowledge and worse still, I hate gray areas :-)
Best Regards
Hans Wedemeyer
http://hans-w.com
Reply
Originally posted by: Rob Manderson
"If enough CPU time is available and no other higher priority threads are ready, the OS allows the running thread to complete its quota of time, which is called thread quantum."
Actually, once a thread is running it will not be preempted until the end of it's quanta - regardless of whatever higher priority threads are waiting. The only exception to this is real-time priority threads waiting on hardware related events.
Also, a thread is free to give up it's time quanta before the quanta has elapsed. Easiest way is via the Sleep API but there are better ways (such as waiting on an event handle).
Reply