The holy bible of SWEB - Institute of Applied Information Processing ...
The holy bible of SWEB - Institute of Applied Information Processing ...
The holy bible of SWEB - Institute of Applied Information Processing ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CONTENTS<br />
CONTENTS<br />
3.4.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40<br />
3.5 Sweb Boot Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43<br />
3.5.1 Boot Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43<br />
3.5.2 Sweb Global Descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . 44<br />
3.5.3 Sweb Boot-Time Paging . . . . . . . . . . . . . . . . . . . . . . . . . . 45<br />
3.5.4 Sweb Post-Boot Paging Setup . . . . . . . . . . . . . . . . . . . . . . 45<br />
3.6 Sweb Task Separation and Protection . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.6.1 Segment Descriptor Privilege Level / Task Privilege Level . . . . . . 46<br />
3.6.2 User- / Supervisor- Page . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.6.3 LoadPageOnDemand . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.6.4 UserThread Termination . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.7 Extending Sweb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.7.1 Using 4MiB Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
3.7.2 Additional pages for the kernel . . . . . . . . . . . . . . . . . . . . . . 47<br />
3.7.3 sharing Memory between linear address spaces . . . . . . . . . . . . 47<br />
3.7.4 Cloning a Tasks linear address space . . . . . . . . . . . . . . . . . . 47<br />
3.7.5 CopyOnWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48<br />
3.7.6 Virtual Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />
4 Kernelspace Memory Management 55<br />
4.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55<br />
4.2 Memory Organisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56<br />
4.3 Important Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />
4.3.1 KernelMemoryManager . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />
4.3.2 MallocSegment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58<br />
4.4 Used Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59<br />
4.4.1 allocating memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59<br />
4.4.2 freeing memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59<br />
4.4.3 reallocating memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />
4.5 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />
4.5.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />
5 Threads and Processes 61<br />
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />
5.2 Details for x86 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />
5.2.1 Example for saving the CPU registers . . . . . . . . . . . . . . . . . . 62<br />
5.2.2 Example for reading back the CPU Registers . . . . . . . . . . . . . . 62<br />
5.3 <strong>The</strong> FPU and other problems . . . . . . . . . . . . . . . . . . . . . . . . . . . 62<br />
5.4 Threads and Processes in <strong>SWEB</strong> . . . . . . . . . . . . . . . . . . . . . . . . 64<br />
5.4.1 Kernel Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64<br />
5.4.2 Userspace Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65<br />
5.4.3 Switching to Userspace . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />
5.5 Multiprocessor Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />
5.5.1 <strong>The</strong> FPU Trick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />
5.5.2 CPU Affinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />
5.5.3 NUMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />
5.6 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />
5.6.1 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />
5.6.2 <strong>The</strong> Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />
4 <strong>of</strong> 151