What do you mean by Shared Resource

Those resources or devices in a processor that are accessed by different instructions at various times during the operation cycle are known as Shared resources. A shared resource can be any device in a system such as memory, printer, register etc. During the execution of complex set of instruction we need to protect our shared resources so that the complete set is executed without any corruption or malfunctioning in the values of shared resources.

Example: – TASK 1 R1 *8

TASK 2 R1= R1+R2

We consider R1 as a shared resource between above two tasks .If we pick the intermediate value of R1 during the execution of TASK 1 then we will land up picking the false value of shared resource and hence we will get an incorrect result of TASK 2.

ATOMIC INSTRUCTION

A single set of instructions that is having a number of complex instructions defined in it is known as an atomic instruction. The basic characteristic of an atomic instruction is that throughout that cycle when an atomic instruction is executed the interrupt is kept disabled .And hence, throughout the execution of an atomic instruction. , no interrupt is detected. And as soon as atomic instruction is executed completely, interrupt is enabled.

WHY DOES IT OCCUR?

Atomic instructions are long and complex set of instructions and hence they use various shared resources for long operation cycles. Since we know that if a single resource is accessed by multiple tasks at the same time then it can produce false results in both the tasks, therefore we keep the interrupt signal disabled during the execution of an atomic instruction.

CONSEQUENCES:

This process causes a delay in interrupt service as the interrupt signal is kept disabled for long intervals. This property of delay in interrupt service is referred to as interrupt latencies. The amount of the delay in serving an interrupt depends upon the length of the atomic instruction. We normally try to keep the interrupt latencies minimum.

HOW TO SERVE AN INTERRUPT:

Processor keeps a check on interrupt signal while running some instruction .And as soon as any interrupt is detected, the address stored in the program counter is moved to stack and the address of the first instruction of interrupt service routine is stored in the program counter .So now ,the program counter starts pointing to words interrupt service routine. Therefore the processor fetch that subroutine and serve the interrupt is served successfully, the adders of stack pointer is again moved to program counter and the processor again continues with the previous task.

You can leave a response, or trackback from your own site.
Leave a Reply to the article

Learning & Certifications
Follow Us
Facebook Icon   Linked In Icon   Twitter Icon  
Validation and Recognition

Valid CSS! Valid HTML5!          Protected by Copyscape

VeChain