Académique Documents
Professionnel Documents
Culture Documents
● Application software is the software that you install onto your Operating
System.
● It consists of the programs that actually let you do things with your computer.
● These Applications are written to run under the various Operating Systems.
These include things like your word processing programs, spreadsheets, email
clients, web browser, games, etc.
● Many programs, such as most of the Microsoft Office suite of programs, are
written in both Mac and Windows versions, but you still have to have the right
version for your OS.
2. Write a program that forks exactly N processes, where N is an input
taken from a user.
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
while (n!=0)
{
remainder = n%2;
n /= 2;
binaryNumber += remainder*i;
i *= 10;
bit_size_N++;
}
return bit_size_N;
}
int main () {
int N;
scanf(%d”,&N)
int i;
int bit_size;
int process = 0;
bit_size = convertDecimalToBinary(N);
pid_t gpid;
gpid = getpid();
for(i=bit_size -2 ; i>=0;--i) {
fork();
if(BIT(N, i) && gpid == getpid())
{
fork();
process++;
}
}
printf(" Number of processes = %d\n",process);
return 0;
}
3) Consider the following set of processes, with the arrival time and length
of the CPU burst times given in milliseconds. Draw the Gantt chart to
illustrate the execution of these processes for the multi-level priority
scheduling queue scheduling algorithm without feedback.
2 2 2 3 4 2 2 2
P1 P2 P3 P4 P3 P2 P5 P1
4) Write a program that has accepts two numbers X and Y from the user.
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
int X, Y;
● This method is good to ensure mutual exclusion but does not guarantee
progress.
● This solution ensures mutual exclusion; but does not guarantee progress. For
instance, what if process with PID=0 exits. All other processes would
eventually wait infinitely in the while loop when turn=0.