Consider the following C code fragment: if fork equals zero, a equals a plus five, print a and the address of a. Else, a equals a minus five, print a and the address of a. Let u and v be the values printed by the parent process, and x and y be the values printed by the child process. Which one of the following is true?
The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to one and fetches the old value of x in y without allowing any intervening access to the memory location x. Consider the given implementation of P and V functions on a binary semaphore. Which statement is true?
A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, and Z. W and X increment x by one. Y and Z decrement x by two. Each process uses a counting semaphore S (initialized to two) before and after modifying x. What is the maximum possible value of x after all processes complete execution?
A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, and Z. W and X increment x by one. Y and Z decrement x by two. Each process uses a counting semaphore S (initialized to two) before and after modifying x. What is the maximum possible value of x after all processes complete execution?
A computation generates arrays a and b, where a[i] = f(i) and b[i] = g(a[i]). Processes X and Y compute a and b respectively, using semaphores R and S (both initialized to zero). Array a is shared. Which code block shows the correct implementation of ExitX and EntryY?
Three concurrent processes X, Y, and Z execute code segments accessing shared variables. Each process uses P and V operations on semaphores a, b, c, and d (all binary semaphores initialized to one). Which order of P operations is deadlock-free?
A shared variable x initialized to zero, is operated on by four concurrent processes W, X, Y, Z. W and X increment x by one, while Y and Z decrement x by two. Each process uses a counting semaphore S initialized to two. What's the maximum possible value of x?
A computation generates two arrays a and b, with a[i] = f(i) and b[i] = g(a[i]). Processes X and Y compute these, respectively, using shared array 'a' and binary semaphores R and S (initialized to zero). Which of the following shows the correct ExitX and EntryY procedures?
A process executes the following code three times: fork. What is the total number of child processes created?
Fetch_And_Add(X, i) is an atomic instruction. It reads the value of X, increments it by i, and returns the old value. It's used below to implement a busy-wait lock. L is an unsigned integer shared variable initialized to zero. What statement is true about this implementation?
Regarding OS process management, which of the following is generally NOT a responsibility of the operating system?
What is the key difference between threads and processes?
Which CPU scheduling algorithm can lead to starvation?
Which of the following is NOT a necessary condition for deadlock to occur?
What is the primary purpose of virtual memory?