answersLogoWhite

0


Best Answer

An interrupt (for example, Intel-based opcode 0xCD) causes the CPU to pause its current execution, store the state of the registers on the stack, then process a defined subroutine. When this subroutine completes, the interrupt finishes, the registers are restored from the stack, and the previous execution state resumes. Interrupts come in two basic flavors: hardware and software.

A hardware interrupt occurs when a connected piece of hardware raises an IRQ signal. This mechanism tells the CPU that the hardware has information that needs to be processed. This is more efficient than polling for devices that have relatively few inputs or that have a latency that the CPU shouldn't wait for. Keyboards and mice are often interrupt-driven; the CPU only needs to know when something interesting has happened (a key was pressed or the mouse was moved, for example). Hard drives are also interrupt-driven; this allows the hard drive to locate the requested data and then return that data some CPU cycles later without the CPU having to request the status of the operation repeatedly.

In contrast, a software interrupt is usually triggered by software as a means of invoking operating system code in a reliable manner. For example, in MS-DOS, a developer would call INT 0x21 in order to invoke typical DOS commands, such as reading or writing a file, obtaining keyboard input, and other basic operations. Most older operating systems running on Intel-compatible processors use software interrupts to provide a way for the program to access system functions. Newer operating systems use new opcodes that circumvent the need for software interrupts, although most platforms still provide this mechanism for legacy software.

User Avatar

Wiki User

βˆ™ 12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 12y ago

This is a terrible question to answer on so many levels. I will attempt to answer it without getting carried away.

A hardware interrupt is a signal produced by a device that informs the CPU that the device needs attention. The CPU then "interrupts" the current running software on the PC and executes code to attend to the interrupt and clear the message. The software then resumes processing.

On x86 based architectures, the interrupt signal is electronically multiplexed to allow for what feels like multiple interrupts with the CPU. This is accomplished using a separate chip, originally the i8259. When the interrupt fires, the system interrupt handler is triggered and then checks the status of the i8259 to identify the interrupt number which has been signaled and looks up a function to execute in a table in memory.

Software can also trigger interrupts similar to hardware and the x86 CPU has been designed to allow identifying a numerical interrupt value to reference the before mentioned interrupt table and cause an operating system function to be called.

On 32-bit CPUs, it has become uncommon to develop using interrupts with the exception of when calling into the operating system kernel. When an interrupt is generated, the context of the application running in ring 3 protected mode and the interrupt handler residing in ring 0 (a generally unprotected mode) is called. So for example, when a windows app wants to allocate more memory than it currently has available, the function VirtualAlloc is called which sets up a call structure to pass to the operating system. It the fires the interrupt and the system drops to ring 0, calls the interrupt handler which then forwards the call to the OS. The OS allocates the memory, stores the result in a structure and them returns to the interrupt handler which then returns to ring 3.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is interrupt in assembly language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does the RET statement do in assembly language?

RETurn from a subrutin or interrupt handler.


Is pseudo code is a) high level language b) assembly language c) machine language?

in RST interrupt , RST STAND FOR


Describe the sequence of events that takes place when an interrupt is raised?

Interrupt Handling 1. Hardware stacks program counter, etc. 2. Hardware loads new program counter from interrupt vector. 3. Assembly language procedure saves registers. 4. Assembly language procedure sets up new stack. 5. C interrupt service runs (typically reads and buffers input). 6. Scheduler decides which process is to run next. 7. C procedure returns to the assembly code. 8. Assembly language procedure starts up new current process.


How will studying assembly language enhance your understanding of operating systems?

Assembly language is a good tool for learning how applications programs communicate with the computer's operating system via interrupt handlers, system calls, and common memory areas. Assembly language programming also helps when learning how the operating system loads and executes application programs.


Why interrupt handlers are written in assembly language?

When an interrupt is requested, the currently running process is suspended and the handler is invoked. When the handler exits, control is handed back to the running process. Since interrupts are practically random and unplanned, when the handler passes back control, it must ensure that all registers and stacks that it used are restored back to the exact state they were in when the process got interrupted, so that the process can resume like as though nothing happened. Access to these registers and stacks can only be done in assembly. Other reasons include the fact that interrupt handlers must be very fast, and since the interrupt routines are very short, they can be hand‐crafted to be much faster than anything a compiler generates.


What computer language uses mnemonic names?

Assembly Language


Disadvantage of writing OS in high level language such as C?

Nothing. Every modern OS is written in C, except for some little special parts (like interrupt-handling) that are written in Assembly.


What is difference between machine code and assembly language?

Machine language is the actual instructions in computer memory that are fetched into the processor and executed. It is directly executable and consists of what look to most human beings like a bunch of hexadecimal numbers, though a few geeks such as myself can tell it is code instead of numbers. For example, the instructions executing interrupt 21, service 10, are: B410 CD21 Assembly language is a human readable as mnemonics, it translates on a one for one basis into machine language. The computer cannot execute assembly language directly, but human beings who are trained can understand it. The assembly language equivalent of the above instructions is: MOV AH,10 ; prepare for service 10 by putting 10 into AH INT 21 ; vectors into code established in the interrupt table


Is c language assembly language?

No.


What Programming language is one step above machine language?

I guess you're trying to refer to Assembly language.


Reserved word in assembly language program?

use of reserved word in assembly language


How would you define assembly language?

assembly language uses abbreviation called menmonics.it is a bit easier to write computer programs in assembly language as compared to machine language but still requires skill and experienci.A program called assembler is used to convert an assembly language into machine language.