Posts

Showing posts with the label exercise

Convergence in Probability and in the Mean Part 1

In this exercise, we'll be working with the notion of convergence in probability, as well as some other notion of converge of random variables that we'll introduce later. First type of random variable is xn, where xn has probability 1 minus 1 minus over n to be as 0 and probability of 1 over n to be a 1. And graphically, we see that we have a pretty big mess. 1 minus 1 over n at location 0, and a tiny bit somewhere here, only 1 over n. So this will be the PMF for x. On the other hand, we have the sequence of random variables, yn. Fairly similar to xn with a slight tweak. The similar part says it also has a very high probability of being at 0, mass 1 over 1 minus n. But on the off chance that yn is not at 0, it has a pretty big value n. So it has probability 1 over n of somewhere out there. So to contrast the two graphs, we see at 0, they have the same amount of mass, 1 over 1 minus n, but for y, it's all the way out there that has a small mass 1 over n. ...

19.2.6 Worked Examples Semaphores

In this exercise, we will learn how semaphores can be used to ensure that different precedence constraints in our programs can be satisfied. Before diving into the use of semaphores to enforce our precedence requirements, let's review what tools we have available to us. You can think of a semaphore as a shared resource that is limited in quantity. If we have a semaphore S that is initialized to 0 then it represents the fact that currently resource S is not available. If S equals 1, then that means that exactly one S resource is available for use. If S equals 2, then there are 2 S resources available, and so on. In order to make use of the shared resource, a process must first grab that resource. This is achieved by adding a wait(S) call before the code that requires the resource. As long as the value of S equals 0, the code that is waiting for this resource is stalled meaning that it can't get past the wait(S) command. To get past the wait(S) call, the value of se...