Building Responsive Apps becomes the most essential need for all Modern Desktop, Mobile and Web applications in all platforms to meet the customer needs. Do you want to wow your customers with greater experience for your Delphi/C++ Builder Applications ? Don’t know how to create responsive apps with Parallel Programming Library ? Don’t Worry! This post will guide you to learn about PPL.
Task: A Task is like a parallel procedure. A Task runs parallel to the main thread. Tasks do no start right away, they are held in a queue and it is managed by a Master thread which allocates thread from a thread pool. It works like Master-Worker pattern with a Thread pool. Thread Pool has a number of threads. Based on CPU the threads are avialable and start when CPU time is available.Tasks run best without serializing dependencies. Check the tutorial for Task here
Future: Future is like a parallel function. A future is actually a task with return result you wait for it (unless the Future gets completed) . The future method returns an instance of IFuture into the variable defined of type
T. Check the tutorial for Future here.
Tasks Chaining: Task can be chained together, e.g) Tasks can wait for results from other tasks. This uses TTask.Wait like how TFuture does. WaitForAll task in a list, or WaitForAnyone to complete.
Parallel For : A Parallel.For Splits a for loop into pieces that run in parallel. It runs through data in parallel( data parallelism) and waits for completion. Use task if you don’t want to wait in thread. Parallel.For uses Task. Tutorial for Paralle.For here
Create Responsive Apps : A Responsive Application never blocks the user interface while processing the data in background and it never waits. Immediate feedback and responsive gives user the great experience. Perceived speed is not equals to actual speed get data and run operations in parallel.
Check this Video for the Delphi Parallel Programming Library to create responsive Apps:
Get to know about the PPL which Delphi/C++ Builder offers. Want to know more about Task Monitoring, Locking, Pools, Patterns and more? See below video.