Architecture/Proposal/Advanced Threading-Architecture
From Apache OpenOffice Wiki
state: sketch
Concept: A purely event driven [threading] architecture, including asynchronous process related signals, I/O and window messages.
- Pros
- Not calling blocking system calls leads to 'short' lasting mutex acquisitions.
- No hand crafted reschedules necessary anymore.
- Easy utilization of Hyper Threading, multi cores and SMP.
- Controlable CPU utilization and possible avoidance of over utilization.
- 'Simple' architecture.
- One single location where to create threads.
- Cons
- (assumed to be) Hard to implement.
Pseudo Code for event loop:
void dispatch(int signal) { switch(signal) { case SIGIO: fileHandler(getHandle()); break; case SIGTERM: ... } } int quit; sigset_t sigset; int main(void) { int signal; while(!quit) { sigwait(&sigset, &signal); dispatch(signal); } return 0; }