Let's assume a condition where ram is 256 MB and the program size is more than 256 MB
in that case, CPU has to wait for I/O to load the remaining part of the program..in this case
CPU utilization is much poorer.
So adding gives benefit only when your CPU is fast enough to take advantage like if a process waiting for I/O
it can put the current process in the run queue and take another process from the ready queue.
This way a better CPU utilization can be achieved.
So by adding ram we can load more programs while waiting for I/O . CPU utilisation will be better.
here by adding 2GB ram we can load 2048/256 = 8 new process into ram at the same time.
2. if cpu have to execute the cpu bound process that wait for I/O cpu will be idle most of the time while
waiting for I/O to be done..this way CPU utilization will be poorer as compare to earlier.
Answer:
// code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int n;
cout<<"Enter a positive number:";
// read number
cin>>n;
// check number is positive or not
while(n<0)
{
// if number is negative
cout<<"Wrong input!!"<<endl;
// ask again to enter again
cout<<"Enter again:";
// read number again
cin>>n;
}
// generate random number between 1 to n
int ran=rand()%n +1;
// print random number
cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;
return 0;
}
Explanation:
Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.
Output:
Enter a positive number:-12
Wrong input!!
Enter again:9
Random number between 1 to 9 is: 2
A presentation program<span> is a </span>software<span> package used to display information in the form of a </span>slide show. It has three major functions: an editor that allows text to be inserted and formatted, a method for inserting and manipulating graphic images, and a slide-show system to display the
<span>The statement that the order or sequence of rules in a Prolog program is usually critical. is false. </span>Prolog programs are simply
knowledge bases. And knowledge bases are collections of facts and rules which describe some collection of relationships that we find interesting.