1. Is busy waiting is always less efficient than blocking wait? Explain.
2. In Bakery algorithm why the loop is used?
3. Compare and contrast Dekker's and Peterson algorithms.Code:while( choosing[j] )do { nothing };
Printable View
1. Is busy waiting is always less efficient than blocking wait? Explain.
2. In Bakery algorithm why the loop is used?
3. Compare and contrast Dekker's and Peterson algorithms.Code:while( choosing[j] )do { nothing };
So what effort have you put into finding the answers so far?
I mean, #3 looks like prime google material.
This is quite clearly some "test" question, so I suggest you refrain from answering, and helping someone who hasn't done their homework/followed the class lectures passing a test they shouldn't.
By the way, I'm not sure your answer is complete.
--
Mats
Indeed, I'll not elaborate, but the question is if it's blocking like through a loop or waiting with a blocking function? That's what bothers me.
Yes, the term "busy waiting" usually refers to "waiting by polling".
--
Mats
No these are not test questions! This questions have cropped up in my mind while reading! I have read few books and did not find the answer! I have read Stallings, Dietel, Galvin and Dhamdhere!
Just bring up the two pages on wikipedia on those two algorithms
- compare means copy the bits which are the same
- contract means copy the bits which are different
Look whenever I ask questions I ask it in a formal way! I like to ask people in such a way so that they need seconds to grasp what I am saying!
Now to all I say! This is not the first time when i have been almost teased off for asking a bit theoretical questions! Every time I hope someone will answer my question! Instead what I get such nonsense answers from over-intellectuals who have posted thousands of answers and put some heavy quotations under their name! Now I tell you all, if you cannot answer why you act in such ways? Someone says these are test question, someone says try yourself! Whenever I participate in any forum my philosophy is that if I cannot answer I do not post or make a stupid behavior out of myself as you all have done! I mean I don't have any words to say you all!
@SALEM
What the hell are you speaking? What do you mean by those two statements?
Whatever Salem is speaking, it's certainly more polite than what you are speaking.
1. http://nob.cs.ucdavis.edu/classes/ec...nc-bakery.html
It's like this implementation of strcpy(). Why is there nothing in the loop? Because all of the calculation is done in the loop condition.
3. Prime google material indeed.Code:while ( *a++ = *b++ );
http://en.wikipedia.org/wiki/Dekker's_algorithm [edit] CBoard didn't recognize this as a URL! :) [/edit]
http://en.wikipedia.org/wiki/Peterson%27s_algorithm
Scroll down to "Two-Process Mutual Exclusion: Dekker's- and Peterson's Algorithms":
http://www.isd.mel.nist.gov/projects.../doc/mutex.htm
I see no reason to click on some links to say wikipedia, prepare some words which "compare and contrast", then post it here just so you can run up to your tutor all "bright eyed and bushy tailed" feeling that you really know something, when you really don't.
@dwks
Thank you for the links! Could you please tell me that why the while statement is used? What would happen without that while loop?
@Salem
Do not act too smart and stop your jugglery of words! If you can answer then reply to any post else not! Posting thousands of replies does not make you something different! Just read what you have replied to the post and then say!
I know that I have been too indecent but I cannot help myself! There are few members I have seen they have unnecessary habit of interfering in every post even if they do not have answer! They do not provide any answer and upon that and reply all sorts of non-sense statements as few have done above! The reality is that after answering so many posts they have developed in them a pseudo-confidence of knowing everything!