Scenario: Operating System Error Handling in File I/O
In the below example, we will consider a scenario where a system user wants to read the file from the local disc drive using the operating system’s file input-output of functions. And in this example, we will cover both the transistor and permanent failure during the processes. Also, we will consider this response Operating system, and how the error handling is been done by the operating system.
Transient Failure
- User Action: The user initiates the process where a file read operation is being performed to open and read the content of a file named report.pdf. Using this operating systems file I/O API.
- Transient Failure: Once the user initiates this process for reading the content from the file, a transient failure occurs, where the file read operation is stopped due to momentary power fluctuation, which causes the disc drive to be briefly disconnected.
- Operating System Response (Error Handling): The movement operating system detects the transient failure while communicating with the disc drive. Its error handling mechanisms get activated like buffered IO and retries. The operating system reattempts or performs retries to build the communication with the disc drive and continues the file read operation from where it was stopped, or from where it was getting disconnected. The user might not be aware that this was a temporary glitch, as the operating system compensates for the transient failure automatically.
Permanent Failure
- User Action: Here, the user initiates to open a file name data.csv, which is located on an external USB device, using the operating systems file I/O functions.
- Permanent Failure: As we have seen permanent failure, is basically caused by hardware and software components. So in permanent failure, the external USB drive encounters a severe physical failure in the read and write head, which makes it impossible or problematic for the operating system to access any data on that particular drive.
- Operating System Response (Error Handling): Once the operating system detects the permanent failure while trying to communicate with the USB device, in this case, the operating system directly cannot recover from the hardware defect. It actually returns an error code that specifies to the user the actual problem which has been caused. So the error message may indicate that the external drive has been filled due to some reason, or due to this, it cannot be actually accessed. The user is also advised to check its drives connexion or take some professional assistance help so that they can perform the data recovery action, or can also replace the faulty drive with a new working drive.
Error Handling in Operating System
An operating system is defined as an interface between the computer system and its users. Once the operating system is loaded into the computer system through the boot program it is responsible for managing all the applications on the device. The operating system is a significant component of the system software in a computer system.
As the operating system is a collection of various software there may be some errors that can cause the system to have some severe fault or severe stoppage of any service which can lead to false results or some defective results to handle this error handling should be properly applied. The below article covers in detail the error, its types, the concept of error handling, and their needs.