1
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x n y without allowing any intervening access to the memory location x. consider the following implementation of P and V functions on a binary semaphore S.

void P (binary_semaphore *s) { 

   unsigned y; 
   unsigned *x = &(s->value); 
   
   do { 

     fetch-and-set x, y; 

   } while (y); 
} 

void V (binary_semaphore *s) { 

   S->value = 0; 

} 
Which one of the following is true?
A
The implementation may not work if context switching is disabled in P
B
Instead of using fetch-and–set, a pair of normal load/store can be used
C
The implementation of V is wrong
D
The code does not implement a binary semaphore
2
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
A Computer system supports $$32$$-bit virtual addresses as well as $$32$$-bit physical addresses. Since the virtual address space is of the same size as the physical address space, the operating system designers decide to get rid of the virtual memory entirely. Which one of the following is true?
A
Efficient implementation of multi-user support is no longer possible.
B
The processor cache organization can be made more efficient now.
C
Hardware support for memory management is no longer needed.
D
$$CPU$$ scheduling can be made more efficient now.
3
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
Consider the following snapshot of a system running n processes. Process i is holding xi instances of a resource R, for $$1 \le i \le n$$. Currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional yi instances while holding the xi instances it already has. There are exactly two processes p and q such that yp = yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?
A
$$\min ({x_p},{x_q}) < {\max _{k \ne p,q}}{y_k}$$
B
$${x_p} + {x_q} \ge {\min _{k \ne p,q}}{y_k}$$
C
$$\max ({x_p},{x_q}) > 1$$
D
$$\min ({x_p},{x_q}) > 1$$
4
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
Consider this C code to swap two integers and these five statements:
void swap(int *px, int *py) 
{ 
    *px = *px - *py; 
    *py = *px + *py; 
    *px = *py - *px; 
}
S1: will generate a compilation error

S2: may generate a segmentation fault at runtime depending on the arguments passed

S3: correctly implements the swap procedure for all input pointers referring to integers stored in memory locations accessible to the process

S4: implements the swap procedure correctly for some but not all valid input pointers

S5: may add or subtract integers and pointers.
A
S1
B
S2 and S3
C
S2 and S4
D
S2 and S5
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12