If you are creating new threads, please start your discussion here.
The comments on the other post is getting too long and confusing.
If you are creating new threads, please start your discussion here.
The comments on the other post is getting too long and confusing.
Any suggestions for Qn4? My answer for this will be D. As disk is a shared resource. Multiple processes can read from the disk.
The disk reads are many orders slower than memory reads. Also a disk read means that the process is blocked for IO. Therefore I think P will not be affected because its request is queued later than Q’s because in that scenario both processes are blocked for IO.
But if P is queued later than Q, wouldn’t P has to wait for Q to finish and thus is blocked for a longer time?
For Q4, I was wondering why process A would be encountering more page faults. Is it because we assume that the memory is large enough to hold only one process such that when two processes are running, process P may encounter page faults?
Thanks Wen Kuan and Bang Hui’s comments, the updated code is:
int current_class = -1, no_waiting_process = 0, no_active_process = 0;
Semaphore m=1,w=0;
(Again, Wei Tsang inserted the pre tag for clarify)
My solution to Qn 14.
The idea is that, the first process lock the other door and the last process unlock the other door. Use count[] to identify the first and the last, and sema[] serves as the lock. In enter_class(), the down() and up() is just to check.
correct me if I am wrong.
I do used the pre tag, but why doesn’t it work…
Sorry about that, Prof.
I really hate the way of this blog.
It just make me and my friends EXTREMELY NERVOUS!!!
at the night of the EXAM!!! for every minute there is a POST from both PROF and students with more and more new materials, codes, videos!!! and confusing notes.
PLEASE STOP THIS BLOG!
make it like other normal exams!
My heart rate is very high right now!!
Relax. You always have the option of not checking this blog for updates.
You mean in other modules, students do not discuss things online the night before exam?
take it easy man…
You, sir, are obviously in need of some stress-relief.
This shall serve you well. Learn well the ways of Master Foo, and you shall be enlightened!
http://catb.org/esr/writings/unix-koans/
u need to relax…
http://www.youtube.com/watch?v=aemXgP-2xyg
HAHAHA the first one is really funny..
the baby really cute…and the subtitles in chinese made it perfect…
lol
its 10:15PM, paper at 9AM tmr, all the best for everyone~
and just for laughs before bedtime: http://www.cracked.com/blog/the-7-dumbest-things-students-do-when-cramming-exams/
I have something like this for q14
it is similar to test&set lock
I think some of the other solutions posted here doesn’t allow multiple processes of same class inside CR
// enter:
while(true) {
down(mutex);
if(count[1 – class] == 0) {
count[class]++;
break;
}
up(mutex);
}
up(mutex);
// do stuff