# Recent questions tagged process-synchronization

1
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
2
Which of the following statements about semaphores is true? $P$ and $V$ operations should be indivisible operations. A semaphore implementation should guarantee that threads do not suffer indefinite postponement. If several threads attempt a $P(S)$ operation simultaneously, only one thread should be allowed to proceed. All of the above.
1 vote
3
A process that is based on IPC mechanism which executes on different systems and can communicate with other processes using message based communication is called _______. Local Procedure Call Remote Procedure Call Inter Process Communication Remote Machine Invocation
4
The operating system and the other processes are protected from being modified by an already running process because they run at different time instants and not in parallel they are in different logical addresses they use a protection algorithm in the scheduler every address generated by the CPU is being checked against the relocation and limit parameters
5
Dispatch latency is defined as the speed of dispatching a process from running to the ready state the time of dispatching a process from running to ready state and keeping the CPU idle the time to stop one process and start running another one none of these
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.
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.
8
The readers and writers problem can be formulated in several ways with regard to which category of processes can be started when. Carefully describe three different variations of the problem, each one favoring (or not favoring) some category of processes. For each variation ... what happens when a reader or a writer becomes ready to access the database, and what happens when a process is finished.
9
The $CDC\: 6600$ computers could handle up to $10\: I/O$ processes simultaneously using an interesting form of round-robin scheduling called processor sharing. A process switch occurred after each instruction, so instruction $1$ came from process $1$, instruction $2$ ... $T$ sec to complete in the absence of competition, how much time would it need if processor sharing was used with n processes?
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.)
11
If a system has only two processes, does it make sense to use a barrier to synchronize them? Why or why not?
1 vote
12
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
13
Consider the two processes need to access $P_{i}$ and $P_{j}$ need to access the C.S. The following synchronization construct used by both the processes. Process Pi While(true){ j=false; i=true; while(j==true); CRITICAL SECTION i=false; } Process Pj While(true){ i= ... while(i==true); CRITICAL SECTION j=false; } I got it is not satisfying M.E., but will it satisfying deadlock too?? Plz explain-
14
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?
15
Design an algorithm for a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of time units (ticks). You may assume the existence of a real hardware clock that invokes a function $tick()$ in your monitor at regular intervals.
Suppose we replace the $wait($) and $signal()$ operations of monitors with a single construct a $wait(B)$, where B is a general Boolean expression that causes the process executing it to wait until B becomes true. a. Write a monitor using this ... construct cannot be implemented efficiently. c. What restrictions need to be put on the await statement so that it can be implemented efficiently ?
A file is to be shared among different processes, each of which has a unique number. The file can be accessed simultaneously by several processes, subject to the following constraint: the sum of all unique numbers associated with all the processes currently accessing the file must be less than $n$.Write a monitor to coordinate access to the file.