Return to the Q&A index

Staff-412@cs Mailing List Questions and Answers

To serve you better: Below are excepts from many of the recent questions and answers logged on the staff-412@cs list. Although this record is not inclusive, it includes any of the posts that we thought might be useful to the class as a whole. Identities have, to the best of our ability, been removed. Some questions and answers have been edited for brevity or topical general interest.

As always, we're here to help -- please give us the opportunity.

Question

Problem 1: Do the producers produce one cake-size dose of each item, or do they produce a unit of each item? For instance, do we have to take 5 eggs off of the buffer, or do we only need to take one container of 5 eggs from the production? Similarly, for the butter, do we have to somehow remove every other time, or do we just use one container with 1/2 cup of butter?

Answer

You can assume the butter container is 1/2 cup, so you can remove one every time. For everything else you can assume you have either a bake-size container or a one-unit (half-unit) container. Whatever you decide, make sure you state your assumptions clearly. And be consistent.

Question

Does the function MixButterSugarVanilla() (for example) remove the butter/sugar/vanilla from the containers, or do we have to take care of that ourselves?

Answer

The functions empty the containers. However, you have to somehow ensure that those functions are not called if there is not enough butter, milk, etc. in the containers, and that only one function uses the same butter, milk, etc.

Question

Problem 4: How are we supposed to draw the arrows on the 2-level page table? Should we have two arrows coming out of each virtual address, one going to each level of the page table, since that address is used in indexing both tables? That would get quite cluttered. Should we instead only have the arrows point to one level? If so, which one, the one with PTEs or the first level?

Answer

I would recommend drawing the 2 arrows.

Question

I think, in the lecture notes for 2/2/2000. They read: (Modulo my fix of line breaks) Three Different Types of Monitors If P does X.wait and Q does X.wait: Hoare Monitors - Q blocks and P runs Mesa Monitors - Q continues, P runs eventually (after Q) BH Monitors - Q can only signal as it exits, P runs Shouldn't that second [non-empty] line read: "If P does X.wait and Q does X.signal:" I hope I'm not misunderstanding this.

Answer

Yes. Fixed.


Question

Hi, I had two quick questions about HW2. First: For problem 4, part b, I'm a bit confused as to how many entries are in each page table. So the "outer page table" (using the book's notation, or I guess level-1 using the HW's notation) has size 4, correct? Do the inner page tables have size 4 as well? This means we'd have >1 inner page tables, which works fine... I'm just wondering if I am interpreting this correctly. Second: For problem 5, part d, if I calculated part (a) correctly, a TLB hit should take 22ns (2ns TLB lookup + 20ns memory access). So, to achieve an effective access speed of 22ns, we would have to have 100% hits... (p*22 + (1-p)*42 = 22, clearly means that p = 1). Is the answer this obvious or am I missing something? Perhaps I should be taking into account the fact that anything less than 22.5 is rounded down??

Answer

Yes, the outer page table, or level 1 as used in the assignment, has 4 entries as stated in the assignment. It's up to you to figure out how many entries the level 2 page tables need, but think about it. Each process must be able to point to all of virtual memory. And yes, you can have more than 1 level 2 page tables, in fact, you will definitely need more than one in this question. Your answer for a TLB hit looks correct, and so does your logic for part d.


Question

Would it be fair enough to add a "nice driver" check to avoid starvation? I.E. If there are a large number of N-S drivers waiting, then E-W drivers will wait for the intersection to empty and allow a S-N driver cross the intersection?

Answer


Question

1.) We still haven't had a definitive answer on whether to strictly prevent starvation or to strictly follow the algorithm as written, allowing the N/S traffic to potentially be starved by the E/W traffic. 2.) Should the cars enter the intersection in a strict fifo ordering, or do we only have to preserve bounded wait (i.e. prevent starvation?) Basically, can the car behind me zip around me and go first, so long as I get to go. 3.) Do condition.wait() calls ensure bounded wait? I.E., if a thread is waiting on a condition that is being periodically signaled, and other threads are periodically waiting on that signal, can that thread be starved and never get woken up while other threads are woken up by the condition.signal() calls? (I'm asking about bounded wait here, not strict FIFO.)

Answer

1)I don't have the answer to this as of yet, but should by 6 pm, so I'll email you that part then. 2)As in a normal traffic situation, try to preserve fifo. This is basically a queue of cars waiting to go through the intersection. 3)I'm not sure how calling condition.wait could ensure bounded waiting unless you ensure that there is an equal number of condition.signal calls that occur eventually without being lost (ie the wait occurs before the signa). I guess it also depends on the scheduling algorithm of the threads, which I think is fifo in a solaris environment. I don't think I totally understand your question here, so please email me back if I didn't answer it!


Question

I was wondering whether the cars in problem 2 travelling in the same direction must proceed through the intersection in order?

Answer

the cars travelling along the same road, ie e/w and n/s should go through the intersection in the order they arrived. But, if a car arrives travelling n or s while a car is travelling through the intersection along the e/w road, it may happen that many cars travel through the intersection along the e/w road before the car travelling n/s goes through.