Homework 6

Homework 6 - CSC301 CSC301Fall2009,Ch6,Ch7 HW6 Homework6...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 301 Homework 6 Velma Teschemaker CSC301 Fall 2009, Ch6, Ch7 HW-6 1. What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating  system? Can busy waiting be avoided altogether? Explain your answer. The term busy waiting means waiting without giving up on the CPU. Other kinds of waiting are  preferred types of waiting which is to wait on a non running queue. Busy waiting can be avoided  however it requires putting the process as a whole to sleep, making it necessary to be woken up at a  later time when the current state of the program is reached.  2. Explain why spinlocks are not appropriate for single-processor systems yet are often used in  multiprocessor systems. Spinlocks are not appropriate for single processor systems mainly because they cause the processor to  break a process out of the spinlock that could be obtained by executing a different process. Other  processes cannot set the program condition that is required for the first process to make progress if the  process is not relinquishing. In a multiprocessor system, other processes execute on other processors  and then modify the program state.  3. Describe how the Swap() instruction can be used to provide mutual exclusion that satisfies the  bounded-waiting requirement. do { waiting [i] = TRUE; key = TRUE; key = Swap(&lock, &key); waiting [i] = FALSE //critical section j = (i+1) % n; while((j !=i) && !waiting [j])
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSC 301 Homework 6 Velma Teschemaker j=(j+1)%n;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Homework 6 - CSC301 CSC301Fall2009,Ch6,Ch7 HW6 Homework6...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online