Subscribe by Email


Showing posts with label Interrupts. Show all posts
Showing posts with label Interrupts. Show all posts

Sunday, July 14, 2013

What is Polling?

- Polling is often referred to as the polled operation.
- When the statuses of the external devices are actively sampled by a client program just like a synchronous activity is referred to as the polling. 
- The common use of the polling is in the input and output operations. 
- In rare cases, polling is also called as the software driven I/O or just simply as polled I/O. 
- As and when required, polling is also carried out with the busy waiting synonymous. 
- Polling is then referred to as the busy–wait polling. 
- In this case whenever it is required to carry out an input/ output operation, the system just checks the status of the device required for fulfilling this operation until it is idle. 
- When it becomes idle it is accessed by the I/O operation. 
- Such polling may also refer to a state in which the status of the device is checked again and again for accessing it if idle. 
- If the device is occupied, the system is forced to return to some other pending task. 
- In this case the CPU time is wasted less when compared to what happens in busy waiting. 
- However, this is not a better alternative to interrupt driven I/O polling. 
- In single purpose systems that are too simple, using busy-wait polling is perfectly fine if the system cannot take any action until the I/O device has been accessed. 
- But traditionally, the polling was thought to be a consequence of the operating systems and simple hardware that do not support multitasking. 
- The polling works intimately with the low level hardware usually. 
- For example, a parallel printer port can be polled for checking whether or not it is ready for printing another character. 
- This involves just the examination of a bit. 
- The bit to be examined represents the high or low voltage stage of the single wire in the cable of the printer during the time of reading. 
- The I/O instruction by which this byte is read is also responsible for transferring the voltage state directly to the eight flip flops or circuits. 
- These 8 flip flops together constitute one byte of a register of CPU. 

Polling also has a number of disadvantages. 
- One is that there is limited time for servicing the I/O devices. 
- Polling has to be done within this time period only. 
- But in some cases there are many devices to be checked which cause the polling time to exceed the given limit. 
- The host keeps on hitting the busy bit until the device becomes idle or clear. 
- When the device is idle, the state is written in to the command register and also in the data out register. 
- The command ready bit is set to 1. 
- The controller sets the busy bit once it knows that the command ready bit has been set.  
- After reading from the command register, the controller carries out the required I/O operation on the device. 
- On the other hand, if the read bit has been set to one, the controller loads the device data in to the data in register. 
- This data is further read by the host. 
- Once the whole action has been completed, the command ready bit is cleared by the controller. 
- The error bit is also cleared for showing that the operation has been completed successfully. 
- At the end the busy bit is also set.
- Polling can be seen in the terms of master slave scenario where the master sends inquiring about the working status slave devices i.e., whether they are clear or engaged. 


Thursday, May 30, 2013

What are the various Desk Scheduling methods?

About Disk Scheduling

The I/O system has got the following layers:
  1. User processes: The functions of this layer including making I/O calls, formatting the I/O and spooling.
  2. Device independent software: Functions are naming, blocking, protection, allocating and buffering.
  3. Device drivers: Functions include setting up the device registers and checking their status.
  4. Interrupt handlers: These perform the function of waking up the I/O drivers up on the completion of the I/O.
  5. Hardware: Performing the I/O operations.
- Disk drives can be pictured as large 1 – D array consisting of logical blocks that are smallest unit of transfer.  
- These blocks are mapped in to the disk sectors in a sequential manner. 
- Mapping is done in the same manner. 
- The responsibility of using the hardware efficiently is the duty of the operating system for the disk drives for increasing the speed of access and bandwidth of the disk. 

Algorithms for Scheduling Disk Requests

There are several algorithms existing for the scheduling of the disk requests:

Ø  SSTF: 
- In this method the request having the minimum seek time is selected from the present head position. 
- This method is a modification of the SJF (shortest job first) scheduling and therefore contains some possibility of process starvation.

Ø  SCAN: 
- From one end of the disk, the disk arm starts and continues in the direction of the other end, serving to the requests till the opposite end. 
- At this end the head is reversed and the process continues. 
- This is sometimes called as the elevator algorithm.

Ø  C – SCAN: 
- A better algorithm then the previous one. 
- This one offers a more uniform waiting time than the previous one. 
- The movement of the head is from one end to another while it services the requests encountered along the way. 
- However, the difference is that when it comes to the other it straightaway goes to the beginning without heeding to any of the requests in the way and then again starts. 
- The cylinders are treated as the circular list wrapped around last and the first cylinder.

Ø  C – Look: 
- This is a modified version of the C – SCAN. 
- Here the arm or the head travels only up to the last request rather than going till the far end. 
- Then immediately the direction is reversed and the process continues.

- For disk scheduling it is important that the method be selected as per the requirements only. 
- The first one is the most commonly used and appeals to the needs naturally. 
- For a system where often there is a heavy load on the disk, the SCAN and C- SCAN methods can help. 
- The number as well as the kind of requests affects the performance in a number of ways.
- On the other hand, the file – allocation method influences the requests for the disk services. 
- These algorithms have to be written as an individual module of the OS so that if required it can be replaced with a different one easily. 
- As a default algorithm, the LOOK or the SSTF is the most reasonable choice. 

Ways to attach to a disk

There are two ways of attaching the disk:
Ø  Network attached: This attachment is made via a network. This is called the network attached storage. All such connected storage devices together form the storage area network.
Ø  Host attached: This attachment is made via the I/O port.


All these disk scheduling methods are for the optimization of the secondary storage access and for making the whole system efficient. 


Friday, May 17, 2013

Define a process? What are sequential and concurrent processes?


- Each and every task which we order our computer to carry out is accomplished by a set of processes. 
- It is these processes that actually run the program. 
- A process can be defined as an instance of the program that is currently being executed. 
- A program’s current activity and the code being executed are stored in the process itself. 
- However, it depends on the operating system that the process is to constitute of multiple threads for a concurrent execution or just one thread for sequential execution. 

This gives rise to two different types of processes namely:

Sequential processes 
Sequential processes can be executed on the same processor but the concurrent processors however may sometimes require more than one processor.

Concurrent processes
Concurrent processes are executed in parallel to each other and at the same whereas the sequential processes go step by step executing one instruction at a time. 

Concepts of Process

- A computer program can be defined as a set of passive instructions. When these instructions are actually executed, they form a process. 
- The same program may have a number of processes associated with it. 
- Multiple processes can be executed by sharing the processors and the resources. 
- If this is done, it is called multitasking. 
- Each processor takes up a single task. 
- With multitasking, switching between the different tasks becomes possible for the processor and so the processes won’t have to wait for long. 
- However, it depends entirely on the operating system when the switch has to be performed:
  1. When the task is performing I/O operations or
  2. When the task itself indicates that it can now be switched or
  3. On hardware interrupts.
- Time sharing is a common type of multitasking and allows interactive user applications to response quickly. 
- In systems using the time sharing systems, switching is done quite rapidly. 
- This gives an illusion of the simultaneous execution of the multiple processes by the same processor. 
- Such type of execution is termed as concurrency.
- Direct communication that may take place between independent processes is avoided by many of the modern operating systems for the reasons of maintaining reliability and security. 
- The inter-process communication functionality is kept under strict control and mediation. 
- In general, the following resources are said to constitute a process:
Ø  Executable machine code’s image associated with the task.
Ø  Some part of virtual memory that is inclusive of the process specific data, executable code, heap and a call stack. Heap is for holding the immediate data generated during the execution and the call stack is for keeping a track of the subroutines.
Ø OS descriptors belonging to the resources that were allocated to the processes. These descriptors may be data sources, sinks and file descriptors etc.
Ø  Security attributes including the set of permissions for the process and the owner of the process.
Ø  Processor state like physical memory addressing or register contents etc. registers store the state during the execution of the process or otherwise it is stored in memory.

- Most of this information is held in the process control blocks regarding the active processes. 
- The operating system makes it a point to maintain a separation between its resources and allocate them the requested resources so that they won’t interfere with the working of each other and thus won’t cause any system failures such as thrashing or deadlocks. 
- But processes do require communicating with each other. 
- For such cases to make interaction safe, operating system has mechanisms especially for the inter-process communication.




Wednesday, May 15, 2013

Define a system call? List the different types of the system calls?


- A program can request for services from the kernel of the operating system through a system call. 
- These services include all the following:
  1. Hardware related services such as data access from the HDD.
  2. Creation and execution of processes
  3. Communication with integral services of the kernel such as scheduling.
- An essential interface is provided by the system call that lies between the operating system and the process. 
- The modern microprocessor architecture consists of a security model specifying multiple levels of privileges for the execution of the software. 
- For example, a program has limitations of its own address space so even by accident it does not modify or access the programs that are executing or the OS. 
- This way the direct manipulation of the hardware devices (such as the network devices and frame buffer etc.) by the program will also be avoided. 
- However, this is not the only case.
- There are situations where the programs really need access to these devices. - This is why the system calls are made available to the programs. 
- System calls ensure that such operations are safely implemented and are well defined. 
- The level at which the operating system executes is the highest privilege level.
- Therefore, the applications requests for the devices to the operating system through the system calls. 
- The execution of the system calls is carried out through the interrupts that would automatically put the CPU at the required level of the privilege. 
- After this, the control is passed on to the kernel. 
- From here the kernel determines whether or not the requested service should be granted to the calling program. 
- If the program is granted the service it requested, a specific instruction set is executed by the kernel which cannot be directly controlled by the calling program.
- These instructions return the privilege level down to that of the program that invoked the call. 
- Finally, the control is returned to the calling program.
- Generally, an API or a library is provided between the operating system and the normal programs. 
- The purpose of this library is to provide wrapper functions for the calls. 
- The names of these functions are same as that of the system calls. 
- The purpose of these functions is to expose a subroutine through which the system call can be used.
- These functions also provide modularity to the system call. 
- But above all, the primary function of the wrapper is placing the arguments in their proper processor registers that are to be passed on to the system call.
- A unique system call number is set that will be called by the kernel. 
- In this way, the portability is increased by the help of this library.
- Making direct system calls in the code of the application is very difficult and so requires embedded assembly code.
- In systems based up on ex-kernel, library is as important as the intermediary as they provide resource management, abstractions and shields the application from a low level kernel. 
- A control transfer involving features specific to the architecture is required for the implementation of the system call. 
- A way of implementing this is by using a software trap. 
- RISC processors can only use the implementation technique via interrupts. 
- But there are some other additional techniques for processors with CISC architectures. 
- One example is of the following two sets developed independently by Intel and AMD respectively for serving the same purpose:
SYSRET/ SYSEXIT
SYSCALL/ SYSENTER
- These were actually control transfer instructions and very fast indeed. 


Saturday, May 4, 2013

What is Context Switch?


- The context switch refers to the process that involves storing and restoring of the context or the state of the process. 
- This makes it possible to resume the execution of the process from that same saved point in the future. 
- This is very important as it has enabled the various processes for sharing one CPU and therefore it represents one of the essential features of an operating system that is capable of multi – tasking. 
- It is the operating system and the processors which decide what will constitute the context. 
- One of the major characteristic of the context switches is that they are computationally very intensive.
- Most of the designing of the operating systems is concerned with the optimization of the use of these switches. 
- A finite amount of time is required for switching from one process to another one. 
- This time is spent in the administration of the process which includes saving and loading of the memory maps, registers etc. plus the various lists and tables are updated. 
- A context switch may mean either of the following:
Ø  A register context switch
Ø  A task context switch
Ø  A thread context switch
Ø  A process context switch

Potential Triggers for a Context Switch

There are three potential triggers for a context switch. A switch can be triggered in any of the three conditions:

1. Multi-tasking: 
- It is common that one process has to be switched out of the processor so as to execute another process. 
- This is done by the use of some scheduling scheme. 
- Here, if the process makes itself un-executable, then it can trigger this context switch. 
- The process can do this by waiting for synchronization or an I/O operation to finish. 
- On a multitasking system that uses pre-emptive scheduling, the processes that are still executable might be switched out by the scheduler. 
- A timer interrupt is employed by some of the preemptive schedulers to avoid process starving of the CPU time.
- This interrupt gets triggered when the time slice is exceeded by the process. - Furthermore, this interrupt makes sure that the scheduler will be able to gain control for switching.

2. Interrupt handling: 
- Modern architectures are driven by the interrupts. 
- This implies that the CPU can issue the request while continuing with some other execution and without waiting for the current read/ write operation to get over. 
- When the currently executing operation is over, the interrupt fires and presents the result to the CPU. 
- Interrupt handler is used for handling the interrupts. 
- The interrupts are handled by this program directly from the disk. 
- A part of the context is automatically switched by the hardware up on the occurrence of an interrupt. 
- This context is enough for the handling program to go back to the code that raised the interrupt.
- The additional context might be saved by the handler as per the details of both the software and hardware designs. 
- Usually, only a required small context’s part is changed so as to keep the amount of time required for handling as minimum as possible. 
- Kernel does not take part in scheduling a process that would handle the interrupts.

3. User and kernel mode switching: 
- A context switch is not required for making a transition between the kernel mode and the user mode in an operating system.
- A mode transition in itself cannot be considered to be a context switch. 
- But, it depends on the OS whether or not the context switch will take place. 


Sunday, April 14, 2013

What are different components of operating system? – Part 5



10. Networking: 
- Presently, many different types of protocols along with applications and hardware for using them are supported by most of the operating systems. 
- The computers running different operating systems can easily become a part of the network and participate in resource sharing activities such as sharing of printers, scanners and of course files. 
- They may connect to network either through wired connection or a wireless one. 
- Through this component, OS of one computer system can access the resources of another computer system at a remote location. 
- Almost anything can be shared including remote computer’s sound and graphics card. 
- There are network services that allow transparent access to a computer’s resources like SSH.
- Client/ server networking allows a system to connect to a server which offers various services to its clients.
- Numbered access points or ports are used for providing these services beyond the network address of the server. 
- Maximum one running program can be associated to each of the port number which will handle all the requests.
- A user program can then access the local hardware resources by making a request to the kernel of its operating system.

11. Security: 
- The security of a computer system depends on the proper working of the technologies involved in it. 
- A modern OS lets you access many resources both for the internal applications and external devices through the kernel. 
- The operating system must have the capability of deciding which requests are to be allowed and which are to be rejected. 
- There are some systems which decide this on the basis of some requester identity which they further classify as privileged or non–privileged. 
- For establishing the identity there has to be some form of authentication. 
- Mostly a username or ID is quoted along with a password. 
- Some other methods are bio-metric data or magnetic cards. 
- There are cases where no authentication is required for accessing resources. 
- Another concept under security is the authorization. 
- The services which can be accessed by the requester are tied to his/ her account or to group in which he/ she belongs. 
- Some auditing options are also offered by systems having a high security level. 
- With these the requests from various sources can be tracked. 
- Internal security is also essential from the programs that are currently executing. 
- It is maintained by raising interrupts to the kernel of the OS. 
- If direct access is provided to the programs for hardware, then security cannot be maintained.

12. User Interface: 
- For an operating system to be operated by a user, a user interface is required. 
- This interface is termed as the shell and is vital if the operating system is to work according to the user’s instructions. 
- The directory structure is observed by the user interface and then it sends requests for the services wanted by the OS from the input hardware devices. 
- It also sends requests to the operating system demanding for the status messages and prompts to be displayed on output hardware devices. 
- There are two most common forms of the user interface namely the GUI (graphical user interface) and the CLI (command line interface). 
- In the former, the environment is visual and in the latter case the commands have to be typed line by line. 
- Almost, all the modern operating systems come with a graphical user interface.
- In some operating systems such as Mac OS, the GUI is already integrated in to its kernel. 
- There are some operating systems that are modular in nature.  


Saturday, April 13, 2013

What are different components of operating system? – Part 4



8. Disk access and file systems: 
- Through this component of the operating system, the users as well as the programs they use are able to sort and organize files on a computer system. 
- This is done through the use of folders or directories. 
- This is another central feature of the operating systems. 
- Data is stored by the computers on disks in the form of files which are then structured in some certain predefined ways so as to enable faster access, better use of available memory and higher reliability. 
- These specific ways of the storing the data on disk together constitute the file system. 
- This makes it possible to assign names and attributes to the files. 
- This in turn helps in maintaining the hierarchy of directories and folders in the directory tree. 
- Only one type of file system and one disk drive was supported by the old operating systems. 
- Those file systems had a limited capacity in terms of directory structures and file names that could be used and speed. 
- These limitations were actually the reflection of the operating system’s limitations making it difficult for it to support multiple file systems. 
- There are other simple operating systems that have a limited range of storage accessing options.
- On the other hand Unix and Linux like operating systems support the VFS technology or virtual file system. 
- Unix offers support for a wide range of storage devices irregardless of their file system or design. 
- This enables them to be accessed via a common API (application programming interface). 
- For programs this avoids the need of having knowledge about the devices which they may require to access.
- With virtual file system, the OS can provide access of unlimited devices to the programs having many file systems operating in them.
- This it does through the use of file system drivers and other device drivers. 
- A device driver lets you access a connected storage device such as flash drives. 
- Every drive has a specific language which is only understood by the device driver and it translates it in to a standard one used by the OS for accessing the drives.
- The contents of the drive can be accessed by the kernel only if the device driver is in place. 
- The purpose of the file system driver is to translate the commands used for accessing the file systems in to the standard set recognized by the operating system. 
- These file systems are then dealt by the programs based on their directories or folders and file names organized in hierarchy. 
- These files can be created, deleted or modified by the programs.

9. Device Drivers: 
- This specifically developed computer software enables the interaction with the hardware devices. 
- It creates an interface through which communication can be done with the device via communications sub system or bus i.e., the means through which the hardware is connected to the system. 
- This computer program depends up on the hardware but is also specific to the operating system.
- It enables an applications software package running under kernel in order to interact with the hardware device transparently.
- Further, it raises the requisite interrupt required for handling asynchronous time dependent interfacing needs of the hardware. 
- Abstraction is the key goal of the device drivers.
- Every hardware model is different and so the operating system cannot know about how each device will be controlled. 
- The way the devices should be controlled is now dictated by the operating systems as a solution to this problem. 
- Therefore, translating the function calls from the OS into calls specific to the device becomes the purpose of the device drivers. 
- Any device would function properly if a device driver suitable to it is available which will ensure the normal operation of the device from the viewpoint of the OS. 

Read the next post "What are different components of operating system? – Part 5"


Thursday, April 11, 2013

What are different components of operating system? – Part 3



6.   Virtual memory: 
- This is that component of the operating system that lets it trick programs to use the memory that scattered all around the RAM and hard disk as one continuous memory location. 
- This chunk of memory is called the virtual memory.
- Using various means of virtual memory addressing such as segmentation and paging implies that it is up to the kernel for choosing the type of memory that might be used by the program at a given time. 
- This enables the use of same memory locations by the operating system for executing multiple tasks. 
- If a program makes an attempt for accessing memory that does not lie in the present range of memory that is accessible but has not been allocated, an interrupt is raised for the kernel in the same way as it would be done for the program if it would exceed its memory. 
- Such an interrupt is called as a page fault.
- When a page fault is detected by the kernel, the virtual memory range of the application is adjusted through which the access to memory is granted to it. 
- In this way, discretionary power is given to the kernel over the memory storage of a particular application. 
- The frequently accessed memory is stored temporarily on the hard disk or other types of media in today’s operating systems. 
- This is done to make some space for the other programs.
- This process is termed as swapping because a memory area is used by a number of programs and its contents can be exchanged or swapped with that of the other memory locations up on demand. 
- Virtual memory is a way of gaining a perception such that amount of RAM is larger than usual in the system.  

7. Multi – tasking: 
- Execution of multiple programs that are also independent on the same system is termed as multi–tasking. 
- It gives appearance that the tasks are being performed at the same time. 
- There are computers that are capable of running at the most two programs simultaneously through the principle of time sharing. 
- A share of computer time is used by each of the programs for their execution. 
- A piece of software known as the scheduler is contained in the operating system whose purpose is to determine how much time will be spent for the execution of every program, and in which order it would take place.
- It also determines how the control will be passed to the programs. 
- The kernel then passes the control to the process allowing the program to access the memory and the CPU. 
- Later on, through some mechanism the control is returned to the kernel so that CPU might be used by some other program. 
- This process of passing control between the application and the kernel is referred to as the context switch. 
- The concepts concerning the application preemption have been extended and used by the modern operating systems in order to maintain preemptive control over the internal run times. 
- The philosophy that governs the preemptive multi–tasking is to make sure that regular time of CPU is given to all the programs.

Read the next post "What are different components of operating system? – Part 4"


Wednesday, April 10, 2013

What are different components of operating system? – Part 2


All the components of an OS must exist in order so as to make the different parts of a system work together in cooperation. All the hardware needs of a software application are satisfied only through the operating system, be it as simple as mouse movement or as complex at Ethernet.


4. Modes: 
- A number of modes of operations are supported by today’s CPUs. 
- CPUs having the capability to support multiple modes at the least use the following two basic modes:
Ø  The supervisor mode: The kernel of the operating system uses this mode for accomplishing low level tasks i.e., the tasks that have no restricted access to the computer hardware. Few examples of such tasks are: communicating with devices such as the graphic cards and maintaining a control over the read, write and erase operations of the memory.
Ø  The protected mode: This mode is just the opposite of the previous one and so is use for everything else. Application software which runs under the protected mode can access the computer hardware only by going through the kernel which in turn controls the tasks only in supervisor mode.
- There are other types of modes similar to the above two, such as virtual modes that might be used by the CPUs for emulating old types of processors such as the following: 32 bit processor on a 64 bit processor or a 16 – bit one on a 32 bit one etc.
- The former one is the mode in which a computer runs automatically after start up. 
- The first programs that run include EFI or BIOS, OS and the boot loader. 
- These programs require unlimited access to the computer hardware because a protected environment can only be initialized outside of one. 
- The CPU is transferred to protected mode only when the control is passed to some other program by the operating system. 
- When a program is running under the protected mode, the number of CPU instructions to which it is granted access might be very limited. 
- If a user wishes to leave the protected mode, he / she can raise a interrupt that will pass the control again to the operating system. 
- This is how an operating system maintains an exclusive control over the issues concerning access to the memory and the hardware. 
- One or more CPU registers that consist of information that is prohibited to be accessed by the currently executing program are collectively termed as the ‘protected mode resources’. 
- If at all an attempt is made for altering this resource, the system switches to supervisor mode.
- Now it is the OS who deals with such illegal operations. It may kill the program.

5. Memory management: 
- Kernel of a multi–programming OS is held responsible for the management of the system memory that is currently under use by the programs. 
- Kernel ensures that the programs under execution do not interfere with the memory being used by the each other.
- Since time sharing principle is followed; each of the programs is given an independent access to the system memory. 
- Early operating systems used to have a cooperative memory management system. 
- It was assumed that all the programs used the memory manager of kernel voluntarily without exceeding the memory limit assigned to them. 
- However,this system of memory management is extinct now because there are bugs in programs that cause them to exceed the limits.
- Failure of a program might cause the memory to be overwritten by the other programs using it. 
- Memory being used by the other programs might be altered by some viruses or malicious code for some purpose which in turn may affect the working of the OS. 
- In such management, the misbehaving programs can crash the whole system. 
- Kernel limits the access to memory for various programs through various methods of memory protection such as paging and segmentation. 

Read the next post (What are different components of operating system? – Part 3)


Tuesday, April 9, 2013

What are different components of operating system? – Part 1


All the components of an OS must exist in order so as to make the different parts of a system work together in cooperation. All the hardware needs of a software application are satisfied only through the operating system, be it as simple as mouse movement or as complex at Ethernet.

1. Kernel: 
- This component of the OS is the medium through which application software can connect to the computer’s hardware system. 
- This component is aided by many device drivers and firmware. 
- With the help of these, it provides a very basic control level for all the hardware devices of a system.
- For programs, the memory access in RAM and ROM is managed by kernel only. 
- It is the authority of the kernel to decide which program should get what access and at what level. 
- The operating state of the CPU is set up the kernel itself all the time. 
- It prepares the data to be stored in long term non–volatile storage like in flash memory, tapes, and disks and so on.

2. Program execution or process: 
- The OS is actually an interface between the hardware and the application software.
- An interaction between the two can be established only if the application abides by the rules and procedures of the operating system as programmed in to it. 
- It is another purpose of the operating system to provide a set of services for simplifying the execution as well as development of the programs. 
- Whenever a program is to be executed, a process is created by the kernel of the operating system and then other required resources such as memory are assigned to it. 
- A priority is assigned to this process if it is a multi–tasking environment. 
- The binary code for the program is loaded in to the memory and the execution is initiated.

3. Interrupts: 
- This component is the central requirement of the operating systems. 
- This is so because the interrupts provide a way of interaction between the OS and its environment which is not only reliable but also effective. 
- The older operating systems worked with very small stacks and therefore watched for the various input sources requiring action for initiating some event (called polling).
- This strategy is not useful in today’s OS that use very large stacks. 
- Here, interrupt - based programming is fruitful. 
- The modern CPU have in – built direct support for these interrupts. 
- With the use of interrupts, a computer knows when to automatically save the contexts of the local registers or run some specific code in response to the occurring events. 
- Hardware interrupts are supported by very basic of the computers. 
- Interrupts let the programmer to specify what code is to be run when a certain even occurs. 
- When hardware receives an interrupt, it automatically suspends the current program being executed by it. 
- The status of the program is saved and the code associated with the interrupt is executed. 
- In modern operating systems, the kernel is responsible for handling the interrupts. 
- Either of the running program or the computer’s hardware might raise an interrupt. 
- When an interrupt is triggered by a hardware device, it is left to the OS’s kernel to decide what to do now through execution of some code. 
- The code that has to be run is decided based up on the interrupt’s priority. 
- The device driver is the software to which all the task of the processing hardware interrupts is assigned. 
- A device driver might be a part of the kernel, or some other program or both.


Facebook activity