Skip to content

Is time-slicing synchronous or asynchronous and why?

The interruptions that occur as a result of the computer’s chronometer indicating a termination of the time interval assigned to a process (time slice), are they classified as synchronous or asynchronous interruptions?



Time interrupts, as hardware interrupts are considered as all hardware interrupts as asynchronous. Despite the fact that this can lead to confusion, let me explain:

Synchronous interrupts are those that happen in synchrony with the cpu instruction clock, that means that they occur at precise moments in the instruction flow. Normally, these synchronised interrupts are called (for this reason) traps. They occur by some event that has been generated internally to the cpu. They can be previsible, like a division by 0, or an oveflow, or can be somewhat unpredictable, like a stack overlow (no pun here 😉 ) or a page fault (the cpu generated an address belonging to a non present page). They result in the same treatement mechanism: the cpu stops the instruction sequence and jumps to an interrupt handler somewhere.

The time interrupt comes at precise instants in time, but the cpu clock is not synchronised to the wall clock, so you cannot predict exactly at what instruction will happen the interrupt. For that reason, they are considered asynchronous. Think on this, if an interrupt can happen at some instruction, but also in the previous one, or the next, then it is asynchronous.

The asynchronous property means that you cannot assume anything about the previous context when the interrupt was issued. For an overflow or a page fault, you can get information about the event to determine what happened (like what was the address that provoked the page fault or what were the numbers to add that produced the trap) but when a hardware interrupts the cpu, your process is normally completely unrelated to the event that is producing the interrupt. A disk ready interrupt can happen while you are doing some calculation, so you cannot get anything useful from the previous stack frame.

There is a special class of traps (synchronous interrupts) that are interesting because they are indeed produced by the program that wants them to happen, they are the software interrupts (or software traps) It is a class of synchronous interrupts that are used to get system services (they are usually called system traps or system calls) They need to isolate completely (for protection purposes) the environment previous to the system call, but they allow to pass arbitrary amounts of information to the kernel.

User contributions licensed under: CC BY-SA
6 People found this is helpful