- Granularity(粒度) of processes as provided by the operating systems on which distributed systems are built is not sufficient. (操作系统给的进程的资源过大，粒度不都细)
Multiple threads per process makes it much easier to build distributed applications and to attain better performance. （真正并发的是线程）
Process & Thread
Processes ensure concurrency transparency costly;
Threads minimum concurrency transparency and let the developers deal with the mutex (mutual exclusion) variable;
One CPU execute only one process in time;
Process contains and manages many threads
Java threads and JVM;
Threads in Distributed Systems
Thread can provide a convenient means of allowing blocking system calls without blocking the entire process in which the thread is running.
• To establish a high degree of distribution
transparency, distributed systems that operate in
wide-area networks may need to hide
– Initiate communication and immediately
proceed with something else
Browsers start displaying data while it is still coming in
Threads for process text, images, scrolling, scripts,
Web servers have been replicated across multiple
machines, where each server provides exactly the
same set of Web documents.
Single thread client : the request is forwarded to one
of the servers, load-balancing such as round-robin;
Multithreaded client: connections may be set up to
different replicas, allowing data to be transferred in
Blocking system calls make programming easier and parallelism improves performance.
– Multi-threaded: blocking system calls and still achieve parallelism.
– Single-threaded: simplicity of blocking system calls, but gives up performance.
– The finite-state machine: achieves high performance through parallelism, but uses non-blocking calls, thus is hard to program.
Virtulazation in Distributed System(虚拟化)
Virtualization in Different Level
An interface between the hardware and software, consisting of machineinstructions that can be invoked by any program.
An interface between the hardware and software, consisting of machine instructions that can be invoked only by privileged programs, such as an operating system.
An interface consisting of system calls as offered by an operating system.
An interface consisting of library calls, generally forming what is known as an application programming interface (API).