|
Distributed operating systemsIn effect, we are simulating the threads and their stacks the hard way. The process is being operated as a finite-state machine that gets an event and then reacts to it, depending on what is in it. It should now be clear what threads have to offer. They make it possible to retain the idea of sequential processes that make blocking system calls (e.g., RPC to talk to the disk) and still achieve parallelism. Blocking system calls make programming easier and parallelism improves performance. The single-threaded server retains the ease of blocking system calls, but gives up performance. The finite-state machine approach achieves high performance through parallelism, but uses nonblocking calls and thus is hard to program. These models are summarized in Fig. 4-4. Model Characteristics Threads Parallelism, blocking system calls Single-thread process No parallelism, blocking system calls Finite-state machine Parallelism, nonblocking system calls Fig. 4-4. Three ways to construct a server. The dispatcher structure of Fig. 4-3(a) is not the only way to organize a multithreaded process ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|