The Gateway to Computer Science Excellence
+4 votes
801 views

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 by Veteran (431k points)
recategorized | 801 views

2 Answers

+3 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)

by Boss (10.9k points)
selected by
0
reentrant is true. But if the program is macro, a single copy of a program cannot be shared by several users?
+3 votes
(C)The program is reentrant.
by Junior (859 points)
0
Thanks for confirming, it should be reentrant according to official definition.
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,385 answers
198,560 comments
105,385 users