Posts

Showing posts with the label program

L22.7 Time of the K-th Arrival

We now follow a program that parallels our development for the case of the Bernoulli process. We will study the time until the first arrival, a random variable that we denote by T1. We're interested in finding the probability distribution of this random variable. And later on, we will continue and try to study the time until the kth arrival. Now T1 is a continuous random variable, because the Poisson process runs in continuous time. And therefore, it has a PDF. But instead of finding the PDF directly, we will first find the CDF of this random variable. So we fix a certain time, T. And we're asking for the probability that the first arrival happens during this interval. Now this is 1 minus the probability that the first arrival happens outside this interval. So we can write this probability as 1 minus the probability that T1 is bigger than t. But what is this event? The first arrival occurring after time, little t, is the same as saying that there were no arrivals ...

18.2.2 SVCs for InputOutput

When a user-mode program wants to read a typed character it executes a ReadKey() SVC. The binary representation of the SVC has an illegal value in the opcode field, so the CPU hardware causes an exception, which starts executing the illegal opcode handler in the OS. The OS handler recognizes the illegal opcode value as being an SVC and uses the low-order bits of the SVC instruction to determine which sub-handler to call. Here's our first draft for the ReadKey sub-handler, this time written in C. The handler starts by looking at the process table entry for the current process to determine which keyboard buffer holds the characters for the process. Let's assume for the moment the buffer is *not* empty and skip to the last line, which reads the character from the buffer and uses it to replace the saved value for the user's R0 in the array holding the saved register values. When the handler exits, the OS will reload the saved registers and resume execution of the ...

11.2.2 Compiling Expressions

A compiler is a program that translates a high-level language program into a functionally equivalent sequence of machine instructions, i.e., an assembly language program. A compiler first checks that the high-level program is correct, i.e., that the statements are well formed, the programmer isn't asking for nonsensical computations, e.g., adding a string value and an integer, or attempting to use the value of a variable before it has been properly initialized. The compiler may also provide warnings when operations may not produce the expected results, e.g., when converting from a floating-point number to an integer, where the floating-point value may be too large to fit in the number of bits provided by the integer. If the program passes scrutiny, the compiler then proceeds to generate efficient sequences of instructions, often finding ways to rearrange the computation so that the resulting sequences are shorter and faster. It's hard to beat a modern optimizing c...