Presentation on theme: "CSC 580 - Multiprocessor Programming, Spring, 2011 Outline for Chapter 6 – Task Execution Dr. Dale E. Parson, week 7."— Presentation transcript:
CSC Multiprocessor Programming, Spring, 2011 Outline for Chapter 6 – Task Execution Dr. Dale E. Parson, week 7
Motivations for Tasks Ideally, tasks are independent activities. Independence facilitates concurrency. Server applications should exhibit good throughput and good responsiveness (low latency). Graceful degradation under overload. Server architecture varieties: Sequential (using Unix select system call for multiple channels) New thread per request (explicit worker threads) – disadvantages include thread lifecycle overhead, resource consumption for too many threads, stability and predictability of the server.
Tasks Interface Executor decouples task submission from task execution. void execute(Runnable command); Executor based on producer-consumer. Activities that submit tasks are producers. Threads that execute tasks are consumers. Executor schedules work to a thread pool. No more threads than processors. Work may vary in time complexity. It is independent.
Executor Interfaces, Classes
Finding exploitable parallelism Server tasks can serve independent requests. Clients can defer portions of task execution. Browser image rendering as a Future task. Subscription server delays requests as Futures. Limitations of parallelizing heterogeneous tasks. It may not break a problem into enough tasks. The tasks may have disparate sizes. Real payoff of concurrent tasks comes with independent, homogeneous tasks. (p. 129)
Software architecture State machine architectures that update alternate copies of state at times T and T+1. Two-phase state machine engines, two copies of state. Phase boundaries entail synchronization overhead. Dataflow architecture minimizes synchronization overhead. Thread-safe data structures may still entail locking. Inter-task communication can avoid unnecessary waiting. Poll until work is done. Stay in motion.
CompletionService Executor meets BlockingQueue. Submit Callable or Runnable tasks. Poll or take Futures for completed tasks. ExecutorCompletionService implements this interface using an Executor to execute tasks. ExecutorCompletionService (Executor) BlockingQueue(Future ) optional parameter. Submit, poll and take methods on the queue retrieves completed or cancelled tasks.
Application architecture Heterogeneous server multitasking does not support application-level concurrency sufficiently for multicore on the desktop. Higher bandwidth streaming multimedia. Sensory motor processing, sensor integration. Higher order search driven by personal needs. Search for the search engines. Ubiquitous multiprocessing in a non-monolithic system architecture approach.