About while(1){ yield(); sleep(1); } in project 5

102 views
Skip to first unread message

LEI

unread,
Nov 26, 2017, 7:26:13 PM11/26/17
to asu-cse-531-fall-2007
Hello Professor,

I have read the discussions about how to stop the clients which finished their jobs. There are three methods:

1. while(1){ yield(); sleep(1); }  // cause the system to be slower
2. while(1){ yield(); }  // use 100% of CPU
3. P(&block_sem); // block on a semaphore which is initialized to 0.

 After trying all of them, I think the third one is the best. It blocks all the finished clients and cause the program to exit eventually when there are no clients running.
I saw your comments on the prior two approaches, but didn't see that about the third one. So, how do you think about it?

Partha Dasgupta

unread,
Nov 26, 2017, 8:51:54 PM11/26/17
to LEI, asu-cse-531-fall-2007
Third one is the best, but it requires a change to the scheduler to quit if no processes in the readyQ (or have an idle process).


Partha Dasgupta,
ASU/CIDSE/Computer Science & Eng. 
EMail: par...@asu.edu
http://cactus.eas.asu.edu/partha

--
You received this message because you are subscribed to the Google Groups "asu-cse-531-fall-2007" group.
To unsubscribe from this group and stop receiving emails from it, send an email to asu-cse-531-fall-2007+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages