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 3.1k views
4 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 1.3k 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 130 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 60 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 146 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 170 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 88 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 28 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 369 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 200 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 331 views
3 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 606 views
1 vote
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_ 567 views
0 votes
1 answer
22
In a system, counting semaphore was initialized to $10$, then $6P$(wait) operations and $4V$ (signal) operations were completed on this semaphore. So _____ is the final value of the semaphore. $7$ $8$ $13$ $12$
asked Dec 7, 2018 in Operating System Arjun 321 views
1 vote
1 answer
23
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 248 views
0 votes
1 answer
25
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 263 views
0 votes
1 answer
26
0 votes
1 answer
27
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 364 views
0 votes
0 answers
28
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 175 views
...