While writing an app in Angular 4 there arose a need to execute some method (task|process|job) in background which would run paralelly to other task in background no matter what the user is currently doing, which component he/she is interacting with. And execute that method so that it doesn't block others.
That background method is realisation of polling, so it periodically by determined interval sends requests to server asking for current status of some object.
Ideally it is better to know how to write collection of such methods which in some interval send requests to server to ask for status of some obects. And none of them blocks others.
My question is what is the best and correct way to write such method/collection of methods.
Thanks in advance for spending your time on this!
P.S. : Turns out i mixed parallelism & concurrency terms. Actually wherever i mention parallelism in this post - i mean concurrency.
Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. Eg. multitasking on a single-core machine.
Parallelism is when tasks literally run at the same time, eg. on a multicore processor.
RichieHindle (c)