Where all of those information stored (NULL, LDT, TSS, and Segment Descriptor)? Are they in Physical Memory, RAM or Local Hard Drive?
The CPU, if it does not cache internally the contents of the GDT, would need to access it every now and then, maybe all the time. The CPU cannot just go and read it from the disk, because it does not know anything about the disk or the file system on it, nor does it know how not to interfere with the OS accessing the same disk. The CPU cannot rely on the OS's help either, because the OS too, in the process of getting something from the disk, can make the CPU fetch something from the GDT. Catch 22.
You really don't want the GDT to be swapped out to the disk. If not for the reason above, then because of performance implications. And so the GDT is always in memory, physical memory (=RAM).
Are Segment Descriptors the same as Code Segment (ASM: CS), Data Segment (ASM: DS), ... and if so how many of those are stored in GDT (Is there only one CS, one DS, ...)?
Segment registers (CS,DS,etc) contain segment selectors, which are basically indices into the GDT (or LDT) in protected mode, these indices point/select the segment descriptors in the descriptor table(s). In the real and virtual 8086 modes it's the same, except the tables aren't used because segment locations and sizes (which we get from the tables in protected mode) aren't arbitrary and need no look up, they are computed immediately.
Note, the following terms mean different things and are not to be confused or used interchangeably:
- segment register
- segment selector
- segment descriptor
- segment descriptor table
- segment
Does Protable Executable (PE) Loader manipulate any of these information?
It shouldn't. Not directly, at least. Most Windows programs use the same segment selector values in CS, DS, ES, SS. The GDT entries, to which these selectors point, don't change, they're global and shared among all programs.
The only thing that usually varies between programs and threads is the segment (and possibly its selector) that's used to access thread-local storage (TLS). The FS or GS segment register holds the selector pointing to this TLS segment. And all accesses to the TLS are done with instructions that use the appropriate segment override prefix (FS: or GS:). TLS is unique to each thread.