• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/14

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

14 Cards in this Set

  • Front
  • Back

1. Listthree degrees of awareness between processes. Why is ‘process-awareness’ animportant issue in designing efficient schemes for interprocess communication?

A process could be in three stages of awareness with regard to its knowledge of other processes. These are: (a) in contention or competition mode, (b) indirectly aware of each other, and (c) directly aware of each other. The means of communication would be predicated by their ability to sense each other. In (c), they could use mailboxes or similar construct to communicate, in (b) they would most likely use shared objects, and in (a) they would contend for their resources via locks. k02=}

1. Whatis a critical section for a process? What is a busy waiting with regard to an entry into a process’s criticalsection? Is buys waiting always less efficient (in terms of using processor time)than a blocking wait? Explain.

A CS is the section of a code that includes the explicit use of sharable resource(s) to carry out some specific action. Busy waiting is the process of checking repeatedly the availability of a specific critical resource by acquiring the CPU. Since it wastes CPU time, it is generally frowned upon; however, if the amount of waiting is extremely small, one could allow busy-waiting in some cases.

What are the two most widely used models of interprocess communications? What are their strengths and weaknesses?

Ans. Two models are: (a) Using semaphores, and (b) using message passing Pros and cons of (a): Semaphores are easy to use. However they are error prone. Pros and cons of (b): Message passing is straightforward via mailboxes particularly for small messages. Time wasted for large messages, and security issues are two of its weaknesses. p0)}

The following code attempts to portray a producer/consumer problem below for an infinite buffer case. For some reason, it doesn’t work. Rewrite the code so that it can run properly with appropriate environment setting.


producer() {


while (true) {


produce(item);


insert(item, buffer);


signal(consumer);


}


consumer() {


while (true) {


wait(producer);


item=delete(buffer);


consume(item);


}







. Producer() {


while (true) {


produce(item);


wait(empty);


wait(buffer);


insert(item, Buffer);


signal(buffer);


signal(full);


}


consumer () {


while (true) {


wait(full);


wait(buffer);


item=delete(Buffer);


signal(buffer);


signal(empty);


consume(item);


}





1. Consider the deadlock situation that can happen in the dining philosophers’ problem where the philosophers obtain the chopsticks one at a time. Discuss how the four necessary conditions for deadlock indeed hold in this setting. Discuss how one can avoid deadlocks by eliminating any of the four conditions.

Mutual Exclusion: When chopsticks are notshared. (To deny this share the chopsticks)Hold & Wait: One chopstick at a time ispicked up (To deny this both chopsticks must be picked up simultaneously) NoPreemption (No one can ‘order’ others to return single chopstick (To deny this,one should have the capability to do so. Design one that is appropriate).Circular waiting: Everyone has a singlechopstick. ( To deny this, ask one to return one’s single chopstick back to thetable). old in\0C}o

1. Althougha state of ‘starvation’ and that of a ‘deadlock’ are apparently very similar,they are very different. Indicate, why! How does one detect the two states?

Starvation is always due to lower processpriority compared to those of others participating. Deadlock is something elsethat does not deal with priority. Eventually one might come out from a starvedstate, but from a deadlock embrace one cannot come out on one’s own. Define deadlock now. Detecting starving processesis difficult, but deadlock detection is easier. One could use circular waitcheck to detect deadlock.

1. Mostround-robin schedulers use a fixed sized quantum. Give an argument in favor ofsmall quantum. Now give an argument in favor of large quantum. Are there anyfor which both are reasonable?

. Small quantum size favors shorter jobs. Large quantum size favors larger jobs particularly if context-switching time is a costly event. Both are reasonable to adopt when jobs are in interactive modes (doing I/O) and are of mostly same size.

a. A deadlock stateoccurs whenever a process is unable to release its request for a resource afteruse.


b. Non-blocking Receivewill return either with a message or without a message.


c. Holdand Wait condition can be prevented by requiring that a process gets all itsresources at one time.


d. Banker’s algorithmto avoid deadlock is unrealistic.


e. In a multilevelfeedback queue system, I/O bound processes tend to populate the bottom lowerpriority queues.

a.F


b.T


c.T


d.T


e.F

1. Identify the set of conditions a correct critical section solution of a process must observe. For instance, one might claim that one must not die or crash within a critical section code, which may or may not be an imperative. Discuss possible relevance of these conditions that you think are important.

.Mutual Exclusion must be obeyed. The process must not compel other processeswanting to enter their CS to starve (Bounded wait clause). No other processfrom outside should compel the process in CS to complete and depart its CS. Aprocess in CS must not do any message passing. t-famil#0z}

1. Shouldgarbage collection in real memory be left to users, or should it be strictly anoperating system's task? Explain your answer. Identify the parameters on whichan initiation of a garbagecollectionprocess may depend.

OS should do garbage collection as it involves shifting participating processes in memory. Parameters should include total number of memory holes produced that are less than a specific threshold size. "T0}8

i. Circular wait on a resource graph implies a deadlock. ii. The hardware TSL type locks need busy waiting.


iii. A process should not be terminated while it is in its Critical Section. iv. An inverted page-table has its last-page entry on the first row, and the first one at the last row.


v. An atomic operation, if started, must be completed before undertaking another operation.

Ans. False, True, True, False,True. ?C

1. A certain computer provides its users with a virtual-memory space of 2 ^32 bytes. The computer has 2 ^18 bytes of physical memory. The virtual memory is implemented by paging, and the page size is 4096 bytes. A user process generates the virtual address 0001 0001 0001 0010 0011 0100 0101 0110. Explain how the system establishes the corresponding physical location.

The page offset bit size = 12. Therefore, the page index would cover the rest 20 bits. For RAM, the page offset bit size = 12 (frame size must be the same as the page size). This leaves only 6 bits to cover frames. Therefore, the page table would show a 20 bit page number mapped to a 6 bit frame number. W0}

1. Whatis the difference between a logical address and a physical address? Consider apaging system with the page table stored in RAM.

A. If accessing RAM takes 200 ns,how long would it take to get a paged memory reference?


B. Suppose we introduce a cachebetween the RAM and the CPU. It is assumed that the hit ratio at the cache is90%. What is the effective memory access time? Assume that finding a page-tableentry in the cache takes zero time if it is there.


For (A): total trip time = 400ns. For (B) it is 0.9 * 20 + 0.1*220 = 40 ns.

) Consider a workload with 5 jobs that each compute for an identical amount of time, , and perform no I/O. To minimize the average waiting time of the jobs, should a FCFS scheduler or a RR scheduler be used?


(b) Assume that job A is running on the CPU. Describe two circumstances in which a SJF scheduler will keep job A running, but a SRTF scheduler will pick a different job. om\":0z{

. FCFS is obviously better than RR since the latter introduces more overhead. On the other part, suppose X enters the CPUQ while A is running, and X needs a lower CPU time than A. SJF being non preemptive would continue with A. If we use SRTF, X would preempt A. \0|#