- 2
- 0
- 约1.15万字
- 约 55页
- 2018-03-06 发布于江西
- 举报
分布式系统英文教案chap-03_zy
Processes Chapter 3 Table of Contents Multithreading Clients and Servers Code Migration Software Agents (special topic) 3.1 Multithreading Process vs. Thread A process is often defined as a program in execution. A thread is a sequence of instructions that can be executed in parallel with other threads. Threads are like lightweight processes. 3.1 Multithreading Process vs. Thread Multiple threads within a single process share the state information, memory and other resources directly, but they are able to execute independently Threads collaborate with each other -- processes compete. …… 3.1 Multithreading Why Multithreading? Allows to perform more than one task at a time. Increases the performance of programs. 3.1 Multithreading When Multithreading? A multiprocessor computer works by using the multiple processors to handle threads simultaneously (multiprocessing). A program that spends a great deal of time waiting for outside events (time slicing). Threads in Nondistributed Systems Interprocess communication (IPC) Pipes, Message queues, Shared memory segments, Semaphore, Signal Heavy context switching user - kernel mode switch in kernel kernel - user mode Threads in Nondistributed Systems Context switching as the result of IPC Threads in Nondistributed Systems Multithreads (in a process) Communicate by using shared data User space switching mostly Don’t bother the kernel = Efficient Thread Implementation Combining kernel-level lightweight processes and user-level threads. Threads in Distributed Systems The usage of threads allows blocking system calls without blocking the entire process in which the thread is running. Multiple threads maintain multiple logical connections at the same time. Threads in Distributed Systems Multithreaded Clients Example: web browser Main HTML file More connections simultaneously for images, … Web servers are replicated Request is forwarded Connections to replicas Transfer data in parallel Threads in Distributed Systems Multit
原创力文档

文档评论(0)