search
Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.

Recent questions tagged process-synchronization

0 votes
0 answers 6 views
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ wants1 = false; } /* ... IT IS WRITTEN PROGRESS IS THERE? In the case when both wants1 and wants2 are true it will indefinitely be postponed then why progress is there?
asked Jun 10 in Operating System anupam_12 5 points 6 views
3 votes
3 answers 1.4K views
Consider the following pseudocode, where $\textsf{S}$ is a semaphore initialized to $5$ in line $\#2$ and $\textsf{counter}$ is a shared variable initialized to $0$ in line $\#1$. Assume that the increment operation in line $\#7$ is $\textit{not}$ ... $0$ after all the threads successfully complete the execution of $\textsf{parop}$ There is a deadlock involving all the threads
asked Feb 18 in Operating System Arjun 257 points 1.4K views
1 vote
1 answer 26 views
as per my knowledge of information in multicore systems we use spinlocks so that while one thread is busy waiting on while loop other thread can work on Critical section. my question is in gate question when busy waiting is being used using while loop do we always ... while one process is busy waiting no other process can work on CS. like in this qsn https://gateoverflow.in/1839/gate2006-61
asked Sep 7, 2020 in Operating System Sneha negi 9 points 26 views
0 votes
0 answers 40 views
How is the option C) satisfy bounded waiting? I mean, there can be a case where the process Q keeps on executing the while loop while process P doesn’t even get the chance. Bounded waiting is the number of times/bounds after which a process gets the chance to enter the critical section. The above code clearly does not support bounded wait, even with option C. Can anyone explain? Thanks!
asked Sep 5, 2020 in Operating System sankalpmittal 41 points 40 views
0 votes
1 answer 63 views
this code does not provide ME Progress Bounded Waiting it is a correct synchronization problem given answer is (d) but how it is free from starvation
asked Sep 1, 2020 in Operating System abcd9982 87 points 63 views
0 votes
1 answer 20 views
Can anyone tell from where to perfect topics – Synchronization and Concurrency in OS? Or how to become self efficient to solve questions in exam
asked Jun 14, 2020 in Operating System prajjwalsingh_11 15 points 20 views
0 votes
0 answers 27 views
Consider the following implementation of a general (counting) semaphore. This implementation assumes the existence of binary semaphore operations upb and downb implemented with a test-and-set instruction. Procedure UP( S : semaphore): downb(mutex) S := S + 1 if (S ... a preemptive or non-preemptive version) c) Priority (you may assign whatever priorities to the processes you wish) d) Round-Robin
asked Jun 5, 2020 in Operating System Chinmay Agnihotri 11 points 27 views
0 votes
0 answers 12 views
Consider the following implementation of a general (counting) semaphore. This implementation assumes the existence of binary semaphore operations upb and downb implemented with a test-and-set instruction. Procedure UP( S : semaphore): downb(mutex) S := S + 1 if (S ... a preemptive or non-preemptive version) c) Priority (you may assign whatever priorities to the processes you wish) d) Round-Robin
asked Jun 5, 2020 in Operating System Chinmay Agnihotri 11 points 12 views
0 votes
1 answer 52 views
In a virtual memory system, size of virtual address is 32-bit, size of physical address is 30-bit, page size is 4 Kbyte and size of each page table entry is 32-bit. The main memory is byte addressable. i. What is the size of main memory? ii. Find out, number of frames in main memory. iii. Find out, number of bits used for storing other information in frame.
asked May 22, 2020 in Operating System kayes360 5 points 52 views
0 votes
0 answers 10 views
SJF scheduling algorithm is frequently used in Long Term scheduling Short term scheduling both A and B None of these.
asked Apr 19, 2020 in Operating System sushmitagoswami 5 points 10 views
0 votes
0 answers 10 views
A multithreaded program $P$ executes with $x$ number of threads and uses $y$ number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock $l$, then it cannot re-acquire lock $l$ without releasing it. If a thread is ... deadlock are: $x = 1, y = 2$ $x = 2, y = 1$ $x = 2, y = 2$ $x = 1, y = 1$
asked Apr 18, 2020 in Operating System admin 573 points 10 views
0 votes
0 answers 16 views
A certain computation generates two arrays a and b such that $a[i] = f(i)$ for $0 \leq i < n$ and $b[i] = g(a[i])$ for $0 \leq i < n$. Suppose this computation is decomposed into two concurrent processes $X$ and $Y$ such that $X$ computes the array $a$ and $Y$ computes the array $b$. The processes ... R); } EntryY(R, S) { V(S); P(R); } ExitX(R, S) { V(R); P(S); } EntryY(R, S) { V(S); P(R); }
asked Apr 18, 2020 in Operating System admin 573 points 16 views
0 votes
0 answers 26 views
Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value of memory location $X$, increments it by the value $i$, and returns the old value of $X$ ... $L$ can take on a non-zero value when the lock is actually available works correctly but may starve some processes works correctly without starvation
asked Apr 18, 2020 in Operating System admin 573 points 26 views
0 votes
0 answers 9 views
The atomic fetch-and-set $x, y$ instruction unconditionally sets the memory location $x$ to $1$ and fetches the old value of $x$ in $y$ without allowing any intervening access to the memory location $x$. Consider the following implementation of $P$ and $V$ functions ... -set, a pair of normal load/store can be used The implementation of $V$ is wrong The code does not implement a binary semaphore
asked Apr 18, 2020 in Operating System admin 573 points 9 views
0 votes
0 answers 9 views
The enter_CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows: void enter_CS(X) { while(test-and-set(X)); } void leave_CS(X) { X = 0; } In the above solution, $X$ is a memory location associated with the $CS$ ... $CS$ at the same time Which of the above statements are TRUE? (I) only (I) and (II) (II) and (III) (IV) only
asked Apr 18, 2020 in Operating System admin 573 points 9 views
0 votes
0 answers 4 views
Given below is a program which when executed spawns two concurrent processes : semaphore $X : = 0 ;$ /* Process now forks into concurrent processes $P1$ & $P2$ */ $\begin{array}{|l|l|}\hline \text{$P1$} & \text{$P2$} \\\hline \text{repeat forever } & \text{repeat forever} \\ \text{$V ... (I) and (II) are true. (I) is true but (II) is false. (II) is true but (I) is false Both (I) and (II) are false
asked Apr 18, 2020 in Operating System admin 573 points 4 views
0 votes
0 answers 10 views
The following program consists of $3$ concurrent processes and $3$ binary semaphores. The semaphores are initialized as $S0=1, S1=0$ and $S2=0.$ ... $P0$ print '$0$'? At least twice Exactly twice Exactly thrice Exactly once
asked Apr 18, 2020 in Operating System admin 573 points 10 views
0 votes
0 answers 9 views
Each Process $P_i$, i = $1....9$ is coded as follows repeat P(mutex) {Critical section} V(mutex) forever The code for $P_{10}$ is identical except it uses V(mutex) in place of P(mutex). What is the largest number of processes that can be inside the critical section at any moment? $1$ $2$ $3$ None
asked Apr 18, 2020 in Operating System admin 573 points 9 views
0 votes
0 answers 19 views
Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others to arrive and then all processes leave the barrier. Let the number of processes in the set be ... to $10$ need not be inside a critical section The barrier implementation is correct if there are only two processes instead of three.
asked Apr 18, 2020 in Operating System admin 573 points 19 views
0 votes
0 answers 16 views
Two processes $X$ and $Y$ ... deadlock The proposed solution guarantees mutual exclusion and prevents deadlock The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion
asked Apr 18, 2020 in Operating System admin 573 points 16 views
0 votes
0 answers 27 views
Two processes, $P1$ and $P2$, need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ ... ensure bounded waiting. It requires that processes enter the critical section in strict alteration. It does not prevent deadlocks, but ensures mutual exclusion.
asked Apr 18, 2020 in Operating System admin 573 points 27 views
0 votes
0 answers 12 views
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$ ... $S$ is initialized to two. What is the maximum possible value of $x$ after all processes complete execution? $-2$ $-1$ $1$ $2$
asked Apr 18, 2020 in Operating System admin 573 points 12 views
0 votes
0 answers 9 views
Consider the methods used by processes $P1$ and $P2$ for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables $S1$ and $S2$ ... properties achieved? Mutual exclusion but not progress Progress but not mutual exclusion Neither mutual exclusion nor progress Both mutual exclusion and progress
asked Apr 18, 2020 in Operating System admin 573 points 9 views
0 votes
0 answers 11 views
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- ... turn = i flag[j] = true and turn = j flag[i] = true and turn = j flag[i] = true and turn = i
asked Apr 18, 2020 in Operating System admin 573 points 11 views
0 votes
0 answers 22 views
Consider the following two-process synchronization solution. ... two- process synchronization solution. This solution violates mutual exclusion requirement. This solution violates progress requirement. This solution violates bounded wait requirement.
asked Apr 18, 2020 in Operating System admin 573 points 22 views
0 votes
0 answers 9 views
Let $m[0]\ldots m[4]$ be mutexes (binary semaphores) and $P[0]\ldots P[4]$ be processes. Suppose each process $P[i]$ executes the following: wait (m[i]; wait (m(i+1) mod 4]); ........... release (m[i]); release (m(i+1) mod 4]); This could cause Thrashing Deadlock Starvation, but not deadlock None of the above
asked Apr 18, 2020 in Operating System admin 573 points 9 views
0 votes
0 answers 14 views
Consider three concurrent processes $P1$, $P2$ and $P3$ as shown below, which access a shared variable $D$ that has been initialized to $100$ ... the minimum and maximum possible values of $D$ after the three processes have completed execution are $X$ and $Y$ respectively, then the value of $Y-X$ is ____
asked Apr 18, 2020 in Operating System admin 573 points 14 views
0 votes
0 answers 11 views
A counting semaphore was initialized to $10$. Then $6 P$ (wait) operations and $4V$ (signal) operations were completed on this semaphore. The resulting value of the semaphore is $0$ $8$ $10$ $12$
asked Apr 18, 2020 in Operating System admin 573 points 11 views
0 votes
0 answers 22 views
Consider the procedure below for the Producer-Consumer problem which uses semaphores: semaphore n = 0; semaphore s = 1; void producer() { while(true) { produce(); semWait(s); addToBuffer(); semSignal(s); semSignal(n); } } void consumer() { while(true) { semWait(s) ... semaphore s when the buffer is empty. The starting value for the semaphore $n$ must be $1$ and not $0$ for deadlock-free operation.
asked Apr 18, 2020 in Operating System admin 573 points 22 views
0 votes
0 answers 4 views
Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is $N$. Three semaphores $empty$, $full$ and $mutex$ are defined with respective initial values of $0, N$ and $1$. Semaphore $empty$ denotes the number of available slots in the buffer, for the consumer to read ... $P: empty, \ \ \ Q:full, \ \ \ R:full, \ \ \ S:empty$
asked Apr 18, 2020 in Operating System admin 573 points 4 views
0 votes
0 answers 10 views
Suppose we want to synchronize two concurrent processes $P$ and $Q$ using binary semaphores $S$ and $T$. The code for the processes $P$ and $Q$ ... $Z, S$ initially $1$ $V(S)$ at $W, V(T)$ at $X, P(S)$ at $Y, P(T)$ at $Z, S$ and $T$ initially $1$
asked Apr 18, 2020 in Operating System admin 573 points 10 views
0 votes
0 answers 13 views
Two concurrent processes $P1$ and $P2$ use four shared resources $R1, R2, R3$ and $R4$, as shown below. $\begin{array}{|l|l|}\hline \textbf{P1} & \textbf{P2} \\ \text{Compute: } & \text{Compute;} \\ \text{Use $R1;$ } & \text{Use $R1; ... processes. If only binary semaphores are used to enforce the above scheduling constraints, what is the minimum number of binary semaphores needed? $1$ $2$ $3$ $4$
asked Apr 18, 2020 in Operating System admin 573 points 13 views
0 votes
0 answers 63 views
Consider the solution to the bounded buffer producer/consumer problem by using general semaphores $S, F,$ and $E$. The semaphore $S$ is the mutual exclusion semaphore initialized to $1$. The semaphore $F$ corresponds to the number of free slots in the buffer and is initialized to $N$. The ... $(F)$ in the Consumer process (I) only (II) only Neither (I) nor (II) Both (I) and (II)
asked Apr 18, 2020 in Operating System admin 573 points 63 views
0 votes
0 answers 11 views
Processes $P1$ and $P2$ use critical_flag in the following routine to achieve mutual exclusion. Assume that critical_flag is initialized to FALSE in the main program. get_exclusive_access ( ) { if (critical _flag == FALSE) { critical_flag = TRUE ; critical_region () ; critical_flag = FALSE; } } Consider ... ) is true Both (i) and (ii) are false (i) is true (ii) is false Both (i) and (ii) are true
asked Apr 18, 2020 in Operating System admin 573 points 11 views
0 votes
0 answers 13 views
Consider two processes $P_1$ and $P_2$ accessing the shared variables $X$ and $Y$ protected by two binary semaphores $S_X$ and $S_Y$ respectively, both initialized to 1. $P$ and $V$ denote the usual semaphore operators, where $P$ decrements the semaphore value, and $V$ increments the semaphore value. The pseudo- ... $P(S_X), P(S_X); P(S_Y), P(S_Y)$ $P(S_X), P(S_Y); P(S_X), P(S_Y)$
asked Apr 18, 2020 in Operating System admin 573 points 13 views
0 votes
0 answers 17 views
The following two functions $P1$ and $P2$ that share a variable $B$ with an initial value of $2$ ... $B$ can possibly take after the execution is______________________.
asked Apr 18, 2020 in Operating System admin 573 points 17 views
0 votes
0 answers 22 views
A solution to the Dining Philosophers Problem which avoids deadlock is to ensure that all philosophers pick up the left fork before the right fork ensure that all philosophers pick up the right fork before the left fork ensure that one particular philosopher picks up the left fork before the right fork, and that all other philosophers pick up the right fork before the left fork None of the above
asked Apr 18, 2020 in Operating System admin 573 points 22 views
0 votes
0 answers 36 views
The following is a code with two threads, producer and consumer, that can run in parallel. Further, $S$ and $Q$ are binary semaphores quipped with the standard $P$ and $V$ operations. semaphore S = 1, Q = 0; integer x; producer: consumer: while (true) ... producer may be lost Values generated and stored in '$x$' by the producer will always be consumed before the producer can generate a new value
asked Apr 18, 2020 in Operating System admin 573 points 36 views
0 votes
0 answers 5 views
Consider the following snapshot of a system running $n$ concurrent processes. Process $i$ is holding $X_i$ instances of a resource $R$, $1 \leq i \leq n$. Assume that all instances of $R$ are currently in use. Further, for all $i$, process $i$ can place a request for at most $Y_i$ additional instances ... $\text{Min}(X_p,X_q) \leq \text{Max} \{Y_k \mid 1 \leq k \leq n, k \neq p, k \neq q\}$
asked Apr 18, 2020 in Operating System admin 573 points 5 views
0 votes
0 answers 8 views
When the result of a computation depends on the speed of the processes involved, there is said to be cycle stealing race condition a time lock a deadlock
asked Apr 18, 2020 in Operating System admin 573 points 8 views
...