In: Computer Science
note (Please solve the questions in the language of operating systems)
[1] Briefly, what is the difference between:
1- Buffering & Spooling.
2- Synchronous & Asynchronous I/O.
3- CPU-bound & I/O-bound jobs.
4- Multiprogramming & Timesharing.
5- Logical & Physical addresses.
6- User & Monitor modes in Operating System.
[2] (i) Define Timesharing.
(ii) In a one processor system, there is an interrupt clock which is set to a “time slice Q”, that is, every Q an interrupt occurs to stop the process. There is only one I/O device in the system which is interrupted when the process needs an I/O. There are 3 processes A, B, C.
Process A executes an I/O interrupt every T units of time.
Process B executes an I/O interrupt every 2T units of time.
Process C executes an I/O interrupt every 3T units of time.
(a) Which of the above processes will benefit the most and which is not when Q = T.
Explain your answer
(b) Which of the above processes will benefit the most and which is not when Q = 2T.
Explain your answer
(a) Which of the above processes will benefit the most and which is not when Q = 3T.
Explain your answer
What is the best value should Q takes for good performance ? explain your answer in full.
[3] (a) Define DMA (Direct Memory Access).
(b) An input device can transmit 100 characters every 4 mils 10 , if the CPU needs 2 mics to service the
Interrupt. How much time is left for asynchronous I/O. What if it can transmit 1000 characters
every 4 mils and the CPU also needs 2 mics for the service routine.
What do you think? Explain your answer in details.
[4] (a) What is the interrupt types? Give examples.
(b) What type of interrupt the following pieces of code in C might generate. Explain your answer.
(i)
int n = 0;
while (n = 0)
printf(“Hello”);
(ii)
int n = 1 , m = 0, x = 10;
while (n/!x<0.001)
{ m +=x;
n++;
}
[5] Draw clearly explaining briefly what is happening the following:
Ans: -
1)
Spooling |
Buffering |
1. The process of holding the jobs for the operating system until unless the operating system is ready to accept and process those jobs. |
Buffering is also similar to the spooling as it holds and store the data temporarily |
2. Spooling can easily handle and overlap the multiple input output of the jobs simultaneously |
It can overlap only one input output of the jobs at a time. |
3. Spooling has large size as it uses the disk space. |
It has small size area in the main memory of the system |
4. Remote processing is supported by spooling. |
It does not provide the remote processing. |
5. It is more efficient. |
It is less efficient |
2)
Synchronous I/O |
Asynchronous I/O |
In this I/O operation the thread enters to the wait state and wait until the I/O operation is completed. |
It asks kernel for the I/O request and kernel gives permission if the I/O operation gets completed. |
Thread waits while I/O operation is being performed. |
Thread does not wait while I/O operation is being performed. |
3)
CPU Bound Jobs |
I/O Bound Jobs |
In this the rate execution of the jobs is restricted by the CPU speed of the system |
In this the rate execution of the jobs is restricted by the I/O speed of the system |
The time for the completion of any job or task is defined by the speed of the CPU |
The time for the completion of any job or task is defined by the speed of the I/O of system |
The interrupts occur in the system may be processed at slower speed. |
When data is being consumed at higher rate than the data request rate |
4)
Multiprogramming |
Timesharing |
When there are multiple programs exists in the memory of the system and then sharing of CPU is known as multiprogramming. |
In Timesharing multiple users can access the system remotely at the same time. |
Multiprogramming provides the uses of CPU for different programs and utilize the CPU time. |
Timesharing allows the multiple users to access the same resource at same time. |
It is used by the programs that resides inside the system. |
It can be used by the users of the system |
5)
Logical Address |
Physical Address |
CPU generates the Virtual address is known as Logical address |
Physical address is the location of the data stored in the main memory unit. |
It can be accessed by the users to get physical address. |
It can not be directly accessed by the user. |
It cannot be accessed physically |
It can be accessed physically |
6)
User Mode |
Monitor Mode |
It is the simple mode used after the booting of the system while using any application. |
It is also called the Kernel mode. |
While the user is using any application or software in any operating system than the system is in user mode |
During the BIOS process of the system when computer gets booted then it is in kernel mode. |
Mode bit is 1 |
Mode bit is zero |
Q.2)
Timesharing: -
In Timesharing multiple users can access the system remotely at the same time. It uses the multiprogramming and CPU scheduling to provide small part of the computer. Timesharing allows the multiple users to access the same resource at same time. It is focused on the time constraint to provide access of the system to multiple members simultaneously without any interruptions.