Paging, Segmentation and Interrupts (1.2.1)
- 20p13280
- Jan 6
- 2 min read
Paging and Segmentation

Pages are all fixed size, pages are physical divisions made to fit sections of memory. Paging doesn't take into account how it splits the program, only that it's split into fixed-size pages. Could split within a looping condition which wouldn't be very efficient, it's better to keep thse instructions together.
Segments are different sizes, they are complete sections of programs. Segments are logical divisions, this means that programs can be split in multiple different sized parts and put into smaller areas of free space. Segments are made to store complete sections of programs.
Differences
Segmentation | Paging |
|---|---|
Segments are different sizes. | Pages are all fixed size. |
Segments are logical divisions. | Pages are physical divisions. |
Segments are made to store complete sections of programs. | Pages split memory based on physical splits, so it may split a looping condition or others. |
Pages are usually smaller (4 KB) |
Interupts
An interupt is a way for other devices and applications to signal to the processor that they need attention. (CB: RE-WORD)
The FDE Cycle has a 4th stage: Fetch, Decode, Execute, Check for new interrupts.
Handling
Interupts cause the processor to stop executing its current program and instead to run code for the interupt, this is known as the interrupt service routine.
Interrupts always have higher priority than normal programs.
The interrupt service routine is a program itself with instructions that need to be fetched, decoded and executed to cary out the oeprations of the interrupt. So registers like the program counter will need to change.
For the processor to be able to continue executing the previous executing program, all the values that are held in the registers are coppied into a stack. Here the values are all put onto a stack frame within the stack.
Once the interrupt has been executed, they can then pop the frame from the stack and load the previous values back into the registers to continue the program originally executing.
Due to stacks being FILO (First In, Last Out) it means that if an interrupt interupts an interrupt, the values in registers for the currently running interrupt service routine can be put on another stack frame and added. Then once that higher priority interrupt has finished, the next ones stack frame can be popped from the stack and it continues until it's back to the previously executing program.
The complete list of interrupts and their interrupt handlers is stored in a table called the interrupt vector table, which is stored in the first 1 Kbyte of addressable memory.


Scheduling
abc
Sources


Comments