Gate Exam

A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing x to memory. Semaphore S is initialized to two. What is the maximum possible value of x after all processes complete execution?

Option
(A) -2
(B) -1
(C) 1
(D) 2

Read Solution (Total 1)

Gate Other Question

Determine the maximum length of cable (in km) for transmitting data at a rate of 500 Mbps in an Ethernet LAN with frames of size 10,000 bits. Assume the signal speed in the cable to be 2,00,000 km/s

Option
(A) 1
(B) 2
(C) 2.5
(D) 5
Consider a hard disk with 16 recording surfaces (0 15) having 16384 cylinders (0 16383) and each cylinder contains 64 sectors (0 63). Data storage capacity in each sector is 512 bytes. Data are organized cylinder wise and the addressing format is . A file of size 42797 KB is stored in the disk and the starting disk location of the file is . What is the cylinder number of the last sector of the file, if it is stored in a contiguous manner?

Option
(A) 1281
(B) 1282
(C) 1283
(D) 1284