i want to get some offers from you about smp. at current moment, i use global cpu's linked list, like this: extern struct cpu { /* gdt */ /* tss */ /* idt */ /* memory area or areas */ struct cpu* next;
} cpus;
so, if we have, for example, 8 cpus, we can't get "atomic" access to needed one, in this case we must walk along cpus list. this problem can be solved by using fixed array. in this case we have another minus, because array must be determined at compile time.
so, if we have only 2 cpu, we will have array size = 2. and if user, for example, add new 2 cpus, he has to recompile kernel to increment cpu array size from 2 to 4.
- linked list can detect number of cpus dynamically, but on nearly each major operation, we should to make searching of needed cpu.
- in fixed array we can fastly get needed cpu, this ds can't determine cpu's number dynamically.