Operating system Notes
Introduction of Operating System
PROCESS: Program to process, Lifecycle of the process, Process control block, IPC
Scheduling
Threads
Memory Management
File Management
Synchronization
Disk Management
IO Management
Protection And Security
Heading
Q
1
What does the processor talk to the I/O device?
Ans
The old processors accessed the I/O devices using special I/O instructions. But, today’s processors communicate with the I/O devices via bus. I/O devices are accessed through memory mapped addresses.
There are three methods with which the I/O devices can be accessed by the processor. They are:
Programmed I/O
In programmed I/O, special I/O instructions are used to communicate with the I/O device
Interrupt driven I/O
Here, the I/O device sends an interrupt signal when it wants to communicate with the processor. When an interrupt occurs, the processor executes the interrupt service routine
Direct Memory Access
In this method, the data is transferred from the memory to the I/O device without the involvement of the CPU. This method is very efficient than the other two methods.
Q
2
What is DMA?
Ans
Direct Memory Access allows the computer to transfer the data directly from the main memory to the I/O device and vice versa. The CPU (or processor) is not involved in this transaction. The DMA is an efficient method because it improves the efficiency of the processor. It speeds up the overall operation of the computer.
Q
3
Give a description about Device Drivers?
Ans
Device drivers help the external I/O device to communicate with the Operating System. Without the device drivers, the interaction between the processor and the I/O devices is impossible. The device driver is a set of files which are hardware specific. The device drivers are needed when the features of the I/O device are not known to the computer.
Q
4
What is the Life Cycle of an I/O request?
Ans
When an I/O request occurs, the current process is blocked if the request is appropriate. Then, the request is processed. Once the I/O operation is completed, the control is transferred to the process, and the output of the I/O operation is returned.
Q
5
What do you understand by Synchronous and Asynchronous I/O System?
Ans
Synchronous I/O system
In a synchronous I/O system, the I/O operations block the current process that is executed by the CPU. Here, the I/O operations are blocking. Synchronous I/O systems can perform either read operation or write operation at a time.
Asynchronous I/O system
In an asynchronous I/O system, the I/O operation and the user processes are executed simultaneously. Many simultaneous read/write operations are allowed. Here, the I/O operations are non-blocking. This system starts the execution of another process before completing the I/O operation. Such systems are more complex and less secure.
Q
6
What are the Blocking and Non-Blocking input output?
Ans
Blocking IO
In a blocking IO, the control is not returned to the process thread until the I/O operation is complete. Blocking IO is used in cases in which the process utterly needs the data from the I/O operation, and the process cannot be executed further until the I/O operation is over.
Non-Blocking IO
In a non-blocking I/O, the call is returned to the thread before the completion of the I/O operation. After the completion of the I/O call, the resulting data is returned to the corresponding application.
Q
7
What are the characteristics of I/O Devices?
Ans
The following are the characteristics of an I/O device
a.An I/O device enables the users to communicate with the computer
b.The I/O devices can send data to the computer and receive data from the computer
c.The I/O devices require corresponding device drivers to interact with the CPU
d.The I/O devices can directly communicate with the memory through the DMA controller.
e. When an I/O device wants to interact with the CPU, it generates an interrupt signal.
Q
8
Write about the Kernel I/O subsystem
Ans
The kernel provides the following services to the I/O devices:
Scheduling
Scheduling refers to the order in which the I/O requests are processed. This order is decided by the priority of the I/O devices.
Caching
Caching helps in storage of data in a memory location which can be accessed by the processor faster than the other memory locations. The cache memory stores the duplicate copy of the data.
Buffering
Buffer stores the data to be transferred between the devices temporarily.
Spooling
A spool is a buffer which is similar to a queue. Spooling is the process in which the data is stored temporarily in a queue until the processor executes it.
Error handling
Any error that occurs during an I/O operation is handled by the kernel.
Device Reservation
The kernel provides exclusive access to an I/O device. The system calls are used for allocation and de-allocation of the device.
I/O protection
The I/O operation is considered as a privileged to prevent the usage of illegal I/O instructions by the user.
Q
9
What are the different modes of Interrupt? How is polling achieved?
Ans
The two modes of interrupt are:
Maskable interrupt
Maskable interrupts are the interrupt that can be disabled by the CPU. Usually, lower priority interrupts are maskable. These interrupts are masked, and executed after the execution of the current process.
Non-maskable interrupt
Non-maskable interrupts are the interrupts that cannot be disabled by the CPU. These are higher priority interrupts. The current process being executed is stopped and the interrupt is handled.
Polling
When more than one interrupts occur at a time, the order in which the interrupts have to be serviced is determined the ISR. Polling method orders the interrupts according to their priority. The interrupts with the highest priority is handled first.
Q
10
Explain the difference between Internal Interrupt and Software Interrupt.
Ans