search
Log In

Recent questions tagged semaphores

6 votes
4 answers
2
Each of a set of $n$ processes executes the following code using two semaphores $a$ and $b$ initialized to $1$ and $0$, respectively. Assume that $\text{count}$ is a shared variable initialized to $0$ ... ensures that all processes execute CODE SECTION P mutually exclusively. It ensures that at most $n-1$ processes are in CODE SECTION P at any time.
asked Feb 12 in Operating System Arjun 2.4k views
3 votes
3 answers
3
The hardware implementation which provides mutual exclusion is Semaphores Test and set instructions Both options None of the options
asked Jan 13 in Operating System Satbir 977 views
0 votes
0 answers
4
A student majoring in anthropology and minoring in computer science has embarked on a research project to see if African baboons can be taught about deadlocks. He locates a deep canyon and fastens a rope across it, so the baboons can cross hand-overhand ... semaphores that avoids deadlock. Do not worry about a series of eastward-moving baboons holding up the westward-moving baboons indefinitely.
asked Oct 30, 2019 in Operating System Lakshman Patel RJIT 95 views
0 votes
0 answers
5
The objective of this exercise is to implement a multithreaded solution to find if a given number is a perfect number. $N$ is a perfect number if the sum of all its factors, excluding itself, is $N;$ examples are $6$ and $28$. The input is an integer, $N$ ... report accordingly. $($Note: You can make the computation faster by restricting the numbers searched from $1$ to the square root of $N.)$
asked Oct 25, 2019 in Operating System Lakshman Patel RJIT 47 views
0 votes
0 answers
6
Write a producer-consumer problem that uses threads and shares a common buffer. However, do not use semaphores or any other synchronization primitives to guard the shared data structures. Just let each thread access them when it wants to. Use sleep and wakeup to handle the ... number once in a while. Do not print more than one number every minute because the I/O could affect the race conditions.
asked Oct 25, 2019 in Operating System Lakshman Patel RJIT 114 views
0 votes
0 answers
7
Suppose that a university wants to show off how politically correct it is by applying the U.S. Supreme Court's Separate but equal is inherently unequal'' doctrine to gender as well as race, ending its long-standing practice ... write the following procedures: woman_wants_to_enter, man_wants_to_enter, woman_leaves, man_leaves. You may use whatever counters and synchronization techniques you like.
asked Oct 25, 2019 in Operating System Lakshman Patel RJIT 121 views
0 votes
1 answer
10
Synchronization within monitors uses condition variables and two special operations, wait and signal. A more general form of synchronization would be to have a single primitive, waituntil, that had an arbitrary Boolean predicate as parameter. Thus, one could say, for example, ... general than that of Hoare or Brinch Hansen, but it is not used. Why not? (Hint: Think about the implementation.)
asked Oct 25, 2019 in Operating System Lakshman Patel RJIT 62 views
0 votes
0 answers
11
Can two threads in the same process synchronize using a kernel semaphore if the threads are implemented by the kernel? What if they are implemented in user space? Assume that no threads in any other processes have access to the semaphore. Discuss your answers.
asked Oct 25, 2019 in Operating System Lakshman Patel RJIT 20 views
1 vote
2 answers
14
Why in reader section we are locking(I highlighted the locking) read_count-- and if section? If we don't use locking what problems might arise? I know that we should use locking whenever we access shared variable but in this particular case I don't see any problem if we don't use locking(highlighted). Please explain what I am missing
asked May 26, 2019 in Operating System Bhaskar Singh 296 views
0 votes
0 answers
15
Galvin, 9th edition on page 146 states that Shared memory can be faster than message passing, since message-passing systems are typically implemented using system calls and thus require the more time-consuming task of kernel intervention. In shared-memory systems, system ... I agree that shared memory is bound to be faster, but aren't the mutex and semaphore calls require Kernel intervention?
asked May 5, 2019 in Operating System vinay chauhan 167 views
1 vote
1 answer
16
a)Mutual exclusion, progress, bounded wait all are satisfied b)Mutual exclusion, progress satisfied but bounded wait not satisfied c)Mutual exclusion satisfied progress, bounded wait not satisfied
asked May 4, 2019 in Operating System Hirak 276 views
2 votes
1 answer
19
0 votes
0 answers
20
Consider the following synchronization construct used by the processes P1, P2, and P3. The S1, S2 and S3 are counting semaphore variables: S1 = 3, S2 = 2, S3 = 1; P(S1); P(S2); P(S3); Critical Section V(S3); V(S2); V(S1); Does it satisfy mutual exclusion, progress and bounded waiting?
asked Jan 6, 2019 in Operating System syncronizing 509 views
0 votes
1 answer
21
a) s1-wait(p) , s2-wait(q) , s3-wait(q) , s4-wait(p) b) s1-wait(p) , s2-wait(q) , s3-wait(p) , s4-wait(q) c) s1-wait(q) , s2-wait(p) , s3-wait(p) , s4-wait(q) d) none of above
asked Dec 12, 2018 in Operating System Rahul_Rathod_ 492 views
1 vote
1 answer
22
Consider a non-negative counting semaphore S. During an execution, 16P (wait) operations, and 4V (signal) operations are issued in some order. The largest initial value of S for which at least three up operations will remain blocked is ___________ Can someone explain me the solution
asked Nov 22, 2018 in Operating System Pavan Shetty 218 views
0 votes
1 answer
24
The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and P1, share the following variables: boolean flag[2]; /* initially false */ int turn; The structure of process Pi (i == 0 or 1) is shown in Figure 5. ... [i] = true; } } /* critical section */ turn = j; flag[i] = false; /* remainder section */ } while (true);
asked Nov 17, 2018 in Operating System Chetan Warke 226 views
0 votes
1 answer
25
0 votes
1 answer
26
Assume Counting Semaphore N=8. On performing 10 down() operations by 10 different processes , first 8 will be successful and last two processes will be suspended. Does this mean that the first 8 processes can enter in the CS at the same time? In other words, does counting semaphore can let multiple processes access the CS at the same time?
asked Nov 7, 2018 in Operating System Shaijal Tripathi 303 views
0 votes
0 answers
27
Let X is an Binary Semaphore with waiting Queue in FIFO order. P1 P2 repeat forever V(X); Compute ; P(X); repeat forever P(X); Compute ; V(X); P1 P2 repeat forever V(X); Compute ; V(X); repeat forever P(X); Compute ; V(X); In which case Starvation for P2 is possible??
asked Oct 29, 2018 in Operating System jatin khachane 1 148 views
0 votes
1 answer
28
How to decide in which question process will run completely and where preemption needs to be taken while solving semaphore questions? Is there any predefined method?
asked Oct 27, 2018 in Operating System asharani97 37 views
0 votes
1 answer
29
after execution of 15p and 18 v operations semaphore value is same as execution of A. 3P C.12P&15V B.3V C. Both B&C what is the solution
asked Oct 20, 2018 in Operating System Divyanshum29 159 views
1 vote
0 answers
30
Will it causing deadlock? How do we fixed it? P1: P2: Wait(S); Wait(Q); Wait(Q); Wait(S); ........ ............. Signal(S); Signal(Q); Signal(Q); Signal(S);
asked Oct 4, 2018 in Operating System srestha 297 views
...