in Operating System edited by
3,212 views
5 votes
5 votes

In multi-programmed systems, it is advantageous if some programs such as editors anf compilers can be shared by several users.

Which of the following must be true of multi-programmed systems in order that a single copy of a program can be shared by several users?

  1. The program is a macro
  2. The program is recursive 
  3. The program is reentrant
  1. I only
  2. II only
  3. III only
  4. I, II and III
in Operating System edited by
by
3.2k views

2 Answers

6 votes
6 votes
Best answer

Macro (which stands for "macroinstruction") is a programmable pattern which translates a certain sequence of input into a preset sequence of output. Macros can be used to make tasks less repetitive by representing a complicated sequence of keystrokes, mouse movements, commands, or other types of input.

In computer programming, macros are a tool which allow a developer to re-use code. For instance,

#define square(x) ((x) * (x))

After being defined like this, our macro can be used in the code body to find the square of a number. When the code is preprocessed before compilation, the macro will be expanded each time it occurs. For instance, using our macro like this:

int num = square(5);

is the same as writing:

int num = ((5) * (5));


Recursive describes a function or method that repeatedly calculates a smaller part of itself to arrive at the final result.

Example:

function factorial(n) {
return (n === 0) ? 1 : n * factorial(n-1);
}

Reentrant is an adjective that describes a computer program or routine that is written so that the same copy in memory can be shared by multiple users. A programmer writes a reentrant program by making sure that no instructions modify the contents of variable values in other instructions within the program. Each time the program is entered for a user, a data area is obtained in which to keep all the variable values for that user. The data area is in another part of memory from the program itself. When the program is interrupted to give another user a turn to use the program, information about the data area associated with that user is saved. When the interrupted user of the program is once again given control of the program, information in the saved data area is recovered and the program can be reentered without concern that the previous user has changed some instruction within the program.

Ans:(C)

selected by
by

1 comment

reentrant is true. But if the program is macro, a single copy of a program cannot be shared by several users?
0
0
3 votes
3 votes
(C)The program is reentrant.

1 comment

Thanks for confirming, it should be reentrant according to official definition.
0
0
Answer:

Related questions