Download presentation
Presentation is loading. Please wait.
Published byAdrian Howard Modified over 9 years ago
1
D75P 34 – HNC Computer Architecture 1 Week 11 Polling and Interrupting. © C Nyssen/Aberdeen College 2004 All images © C Nyssen/Aberdeen College except where stated Clipart on slide 2 © www.clipart.com with non-distribution licence Prepared 12/01/05www.clipart.com
2
In any computer system, the processor will have to handle input and output from multiple devices. If more than one device requires attention at any given time, how does the processor know which device has priority?
3
Processors handle multiple devices by one of two mechanisms – Polling Interrupting Each approach has advantages and disadvantages.
4
The processor goes round each device in turn, querying whether there are any resources required. On older systems without many peripherals, a polling approach would be used.
5
This is equivalent to a salesperson with a fixed customer base. He or she will visit each of the customers in turn, asking whether they need anything. The advantage of this is that it is a very simple system to implement.
6
The disadvantage, of course, is that once the rep. has left, the customer has to wait until the next sales round. The customers needs are not always met timeously! This is also very wasteful of available resources. With the advance of processor and RAM speeds, polling is not often used in modern systems.
7
Instead of Polling, most modern systems use an Interrupt mechanism. With interrupting, the focus of the handling has changed. Instead of the device waiting for a query from the processor, it goes to the processor and interrupts it. The big advantage of this is speed. Devices can have their requirements met much more quickly.
8
This approach equates to the salesperson sitting in the office waiting for customers to call and place their orders. If more than one order is received at the same time, some sort of priority system will have to be used.
9
The disadvantage of this, however, is complexity. If two devices interrupt the processor at exactly the same time, how does the processor know which is the more important? The software and hardware required for an interrupt approach is much more expensive to design and implement. Due to the speed factor, however, it is the favoured mechanism for most modern systems.
10
All modern computers have Interrupt Request lines (IRQs) to help prioritise calls from devices and peripherals. There are usually 16 of these, numbered 0 – 15. Ideally each device should have it’s own IRQ. It is easy to see which devices are using which IRQs. Windows usually sets up IRQ lines by default.
11
When installing a new peripheral, it may try to default onto an IRQ that is already being used by something else. In this event the system will generate a Hardware Conflict. One, or both, of the devices may not work until this is manually resolved.
12
Generally speaking, the lower the IRQ number, the higher the priority. A device on a lower IRQ can interrupt a higher one and “steal” it’s place in the queue! This is called a nested interrupt. However, the IRQ numbers do not run in order!
13
There are never any devices on IRQ2. Older computers only had 8 IRQ lines, and the demand for lines soon outstripped this as systems became more complicated. IRQ2 then became a “cascade”, or a stepping stone to the higher 8 numbers. So the order of priority is actually – 0, 1, 8, 9, 10, 11, 12, 13, 14, 15, 3, 4, 5, 6 and 7.
14
For your assessment question, you will be given one computerised and one non-computerised scenario, and asked to describe which elements of each use polling or interrupt-driven mechanisms.
15
Three problems for you to try. First problem – Dustbin Men. “The Council bin lorry comes round on Mondays and Thursdays to empty the bins”. “If you have to dispose of a large item such as a fridge, you have to telephone the Council to arrange a special collection”. Which is which? You will also be asked to state the advantages and disadvantages of each approach.
16
Second Problem – the Israeli Lift. A 30-storey office block in Tel Aviv has a special Shabbat Lift installed. A Shabbat Lift is an automatic elevator which operates according to a preset program, and is not influenced by the passengers in any way. Such an elevator stops for a fixed predetermined time at each floor. A buzzer sounds to warn the passengers not to interfere with the doors when they are about to close.
17
From Saturday nightfall until Friday nightfall, the elevator operates as usual - if someone presses a button, the elevator will stop at that floor and no other. But from nightfall on Friday until nightfall on Saturday, the elevator will stop at every floor whether someone has pressed a button or not. Identify which elements of this scenario work on a polling mechanism, which work on an interrupt mechanism, and why. What are the advantages and disadvantages of each mode of operation?
18
General elections are held at least every five years. However not all Parliaments run for the whole five years, and a general election may be held before this period is up. In the event of a government having a small majority the election may well take place much earlier. The general election of February 1974 resulted in a minority Labour government. The Prime Minister, Harold Wilson, called another election in October 1974, which resulted in Labour increasing its representation to just above 50% of the number of seats. Despite its small overall majority, the Labour government then remained in power for four-and-a-half years, finally calling an election in May 1979. Third Problem – the British Constitution.
19
In between general elections, by- elections are held as necessary to elect a new Member of Parliament to an individual constituency. A parliamentary by-election is held when a seat falls vacant in the House of Commons, because an MP dies, resigns or can no longer be an MP. Identify the mechanism which causes a General Election, or a Parliamentary By-election. What are the main differences between the two?
20
Summary A Polling mechanism is where the processor queries each device in turn, asking whether it requires resources. An Interrupt mechanism is where the devices go to the processor, demanding resources. Polling is simple and cheap, but slow. Interrupting is complex and expensive, but fast. Interrupts have to be prioritised. Modern systems use 16 IRQ lines to accomplish this.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.