Question
P1 P2
if (a < 0) b = 10;
c = b-a; a = -3;
else
c = b+a;
If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?
a.
4
b.
7
c.
10
d.
13
Posted under GATE cse question paper Operating System
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization) P1 P2 if (a < 0) b = 10; c = b-a;...
Similar Questions
Discover Related MCQs
Q. Which of the following is NOT a valid deadlock prevention scheme?
View solution
Q. More than one word are put in one cache block to
View solution
Q. Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
repeat
flag [i] = true;
turn = j;
while ( P ) do no-op;
Enter critical section, perform actions, then exit critical
section
flag [ i ] = false;
Perform other non-critical section actions.
until false;
For the program to guarantee mutual exclusion, the predicate P in the while loop should be.
View solution
Q. Which combination of the following features will suffice to characterize an OS as a multi-programmed OS?
(a) More than one program may be loaded into main memory
at the same time for execution.
(b) If a program waits for certain events such as I/O,
another program is immediately scheduled for execution.
(c) If the execution of program terminates, another program
is immediately scheduled for execution.
View solution
Q. Consider the following statements with respect to user-level threads and kernel supported threads
i. context switch is faster with kernel-supported threads
ii. for user-level threads, a system call can block the
entire process
iii. Kernel supported threads can be scheduled independently
iv. User level threads are transparent to the kernel
Which of the above statements are true?
View solution
Q. The minimum number of page frames that must be allocated to a running process in a virtual memory environment is determined by
View solution
Q. Consider a small two-way set-associative cache memory, consisting of four blocks. For choosing the block to be replaced, use the least recently used (LRU) scheme. The number of cache misses for the following sequence of block addresses is 8, 12, 0, 12, 8
View solution
Q. Suppose that we have an ordered file with one million records, stored on a disk. The block size is 2048b, records are of fixed size and are unspanned. The record length is 256b., then what is the number of blocks required for the data file.
View solution
Q. Let the ordering key field of the file is 10 bytes long and a block pointer is 6 bytes long and a primary index has been constructed for the file. Then to search a record using index how many block access are required??
View solution
Q. Memory, also called random access memory, or RAM
View solution
Q. CPU scheduling takes place when
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Operating System? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!