edited by
3,253 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
edited by

2 Answers

Best answer
6 votes
6 votes

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
3 votes
3 votes
(C)The program is reentrant.
Answer:

Related questions

3 votes
3 votes
3 answers
2
Arjun asked Apr 22, 2018
10,879 views
The following $C$ program:{ fork(); fork(); printf("yes"); }If we execute this core segment, how many times the string yes will be printed?Only once2 times4 times8 times
3 votes
3 votes
2 answers
3
Arjun asked Apr 22, 2018
3,777 views
The difference between a named pipe and a regular file in Unix is thatUnlike a regular file, named pipe is a special fileThe data in a pipe is transient, unlike the conte...