I understand that both tables contain segment descriptors that provide access details for each segment, including the base address, type, length, access rights ...etc.
Looking at this blog describes the differences as follows:
1. GDT have only one copy in system while LDT can have many
2. GDT may not changed during execution which LDT often changes when task switches
3. entry of LDT is save in GDT. Entries in GDT and LDT have the same structure.
How does the system use these structures differently in an actual program?
The GDT is used to store memory blocks containing supervisor code, such as interrupt/exception handlers, and the blocks used by the kernel itself, so they are system-wide.
OTOH, a multitask OS must store where in memory the memory blocks that comprise a specific task are located. For that, a separate LDT can be used per task. Switching process involves loading a different LDT into the LDTR register.
Each task can see the memory blocks whose descriptors are, either referenced in the current LDT, or in the GDT. For user mode memory access, it will use local descriptors. For system calls, it can use various techniques, for example the INT instruction. This instruction effectively jumps to a code resident in a descriptor from the GDT. I can't remember if call gates are specific to GDT or they can be used in LDT too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With