ICS 331: System Software (981)

Quiz # 5

Date: November 17, 1998                                                                                                                 Time: 20 minutes

Question 1:                                                                                                                                                   (6 Points)

  In few lines describe how a loader can support automatic library search.

  1. For every symbol in the refer record, insert it in the EŭSTAB if it is not there with its address as undefined.
  2. Whenever the address of these symbols are known they should be inserted in the ESTAB.
  3. At the end of Pass1 for all these symbols not defined search for them in the library. If found update their
    addresses. Otherwise flag them as undefined external symbols.

Question 2:                                                                                                                                                   (8 Points)

  Assume you have a program P that, during its execution, it needs to dynamically link to a program S from
  a library of subroutines. Describe in few lines how the above task will be executed.

  1. When program P needs to link to program S it will call the operating system (O. S.) with the name S.
  2. The O. S. will search the library for S then it loads it into the memory.
  3. The O. S. then passes control to S to execute.
  4. When S terminates its execution it passes control back to the O. S.
  5. The O. S. then passes control back to P to resume its execution.

Question 3:                                                                                                                                                   (6 Points)

  As a simple algorithm of few lines, describe how a typical macro processor works.

While OPCODE "END" do

    read source line

    if OPCODE = "MACRO" then DEFINE-MACRO

    elseif OPCODE = macro-name then EXPAND-MACRO

    else write source line into expanded file.