Practice Exericse 11

  1. Write a short C function that takes in a virtual address and translates it to a physical one, using global variables BA (base address) and FL (field length) as exemplified in Fig. 4. If there is an error, it prints out an error message and ends the program by doing exit(1); Otherwise, it returns the physical address.

  1. Some systems may have a protection scheme whereby the ending address is stored in a register, sort of like the FL (field length) register discussed in the chapter. Discuss how this scheme is better, worse or just the same as storing the field length. Just to be clear on what we mean, the "Field Length" register in this new scheme would store 3600 instead of 1100, as shown in Fig. 4.

  1. You might think that your personal computer would never have need of multiprogramming or round-robin job scheduling since there is only one user using it at any given time. Think of why this chain of reasoning is wrong and why you should have multiprogramming.

  1. OS/3, a new super-duper operating system marketed by HAL Corp., is so amazing that it will even read the future and predict stock market fluctuations, making its users billionaires. It only runs on the Hinbell 80786 chip which runs at 50 MIPS (million instructions per second). OS/3 takes over control of the processor after user jobs run for one second. Then it does about 87,000,000 instructions before returning control to the user job. What is the overhead of OS/3?

  1. The IBM 360 had many base registers, not just one, and they were actually just the general purpose registers R0 through R15 which ordinary user programs could inspect and alter.
  1. Why would the FL register approach outlined in Section 11.5 not work for this system?
  2. Why was it safe to put the base address or base addresses into registers which users could change? Wouldn't this give them access to every location in memory, thereby circumventing security?
  3. If the CDC's operating system needed to move a job around in memory while it was running (probably due to the need to compact memory), what would the OS have to do to get the addressing to still work out correctly?
  4. Why couldn't jobs be moved around in the IBM 360 once they started?

  1. The following CSC-1 program was compiled and linked as though it were located at position 0:
                   0:       LOD   1000
                   1:       ADD   1001
                   2:       SUB   1002
                   3:       STD   1003
                   4:       LOD   2000
                   5:       SHL
                   6:       SHL
                   7:       ADD   1003
                   8:       STD   1000
                   9:     (gap)
                   1000:    NUM   47
                   1001:    NUM   3
                   1002:    NUM   149
                   1003:    NUM   0
                   ...
                   1500:    NUM   99
    
    However, the program is then relocated to address 2900. Change the program in order to relocate it. Cross out whatever is changed, and write the new value next to it.