Computer Systems Organization (Tietokoneen toiminta ) Summer -99

Exercise 7 (Wednesday 18.8. )


1. Answer the following questions:
a) Where is the TLB (Translation Lookaside Buffer) located? What information is stored in the TLB?
b) Explain when and how the translation look aside buffer is used. What benefits does the use of TLB bring? Could virtual memory work without TLB? It is possible that TLB could cause some harm?
c) Would it make any sense to substitute the validity bit (V-bit) with the process identifier (PID) and to add an extra register PidR into MMU for storing the PID? Explain when and how is the TLB used. What are the main advantages of a TLB? Could we have a virtual memory without a TLB? Could the TLB cause any problems? Where is the translation lookaside buffer TLB located? What information do the TLB elements hold? Would it make any sense to substitute the validity bit (V-bit) with the process identifier (PID) and to add an extra register PidR into MMU for storing the PID? Explain when and how is the TLB used. What are the main advantages of a TLB? Could we have a virtual memory without a TLB? Could the TLB cause any problems?
d) For what purpose are relocation tables needed? What information is stored in the relocation table?
e)What is a linker used for?

2. Let's suppose the following: there's a process called Measure, the purpose of which is to read a sensor. Measure keeps updating a data structure which holds two values: the sum of the sensor measurements done (SUM) and the number of these measurements (COUNT). Let there be another process with the name Show. The Show process is continuously displaying the average of the measurements lately done (AVG).

Should the AVG be calculated in that instant when SUM is already updated but COUNT is still waiting for Measure to change it, AVG will be too large as a result! Write a subprogram STORE and a function AVERAGE with which the two processes are able to get synchronized properly - that is, the real average value will always be displayed. Describe how STORE and AVERAGE function in a general level (use synchronizing primitives). It is enough if you just give the names and initial values for the semaphores; there's no need to consider how, when or by whom they are actually set.

3. Expand the third semaphore example (page 117) to cover situations where there are three processes executing and none of them is allowed to proceed before the other two processes have arrived to a certain point.

4. Let's assume that the operating system of the TTK-91 computer provides the following services:


SVC SP,=CREATE_PROCESS    ; creates a process 
SVC SP,=HALT              ; terminates  the process

What actions should these services carry out? What information should the caller pass (in stack or in registers) to these service routines? Among others the command interpreter uses the service CREATE_PROCESS when a user starts a new program.

5. What information does the operating system keep in the PCB? Try to figure out for each piece of information in the PCB when and why the operating system needs it. Where is the PCP located?

6. The virtual page size is 1024 words (0 ... 1023). The size of the virtual memory of a program is 10 pages consisting of virtual addresses 0... 10239) and the main memory has 4 page frames with physical addresses 0 ... 4095. The content of the page table at a certain moment is following:
Page number Page frame Presence bit
0 3 P=1
1 0 P=1
2 P=0
3 P=0
4 1 P=1
5 P=0
6 P=0
7 P=0
8 2 P=1
9 P=0

The program refers to virtual addresses 546, 800, 1023, 1024, 2048, 3000, 5000, 8000, 9000. What are the physical (real) addresses corresponding to these virtual addresses. Which of these references cause page fault interrupts?