0
votes

I am working on simple computation program that consist of three functions.

First f1() generates some kind of data and stores it in a buffer (vector or queue or whatever).

Second f2() takes that data and do some computations on it and results stores in another buffer.

Third function f3() visualizes (creates plots, reports, etc) on results of f2().

That three functions needs to run at the same time on single core machine. I know about PARFOR loop and matlabpool. But it can create max number of threads (workers) = min(8, 'number of cores in machine'). Is there any solution to create a few threads in matlab on single core machine?

1
Correct me if I'm wrong, but with each function using taking the output of the previous function as input, it sounds like they all need to run sequentially rather than parallelly. - Eitan T
f1 and f2 stores its result in a kind of buffer so all functions can be run independently. If buffer is empty it does nothing, if not empty it computes that data. But all functions must run in parallel - SP5RFD
Are the functions deterministic? Cause on first look I don't see why they would need to run 'all the time'. - bdecaf
This is a simulation of a simple real-time signal processing system. First function generates noise and some signals. This is not deterministic. Functions needs to run 'all the time' until user terminate whole program. I just need some hint how to create new threads in matlab on single core machine. I can't believe that such a powerful tool as MATLAB doesn't support such a basic thing. - SP5RFD
just for clarification - so f2 and f3 are deterministic? - bdecaf

1 Answers

0
votes

As I see it you have several options:

  1. make your own threading. Basically it would be just one loop that continuously calls the functions.
  2. Use an observer pattern to have the results update once the dependent input changes (is actually also a threading - but keeps the functions from recalculating already evaluated input)
  3. start several matlab processes on your machine and have them send/receive the data through some protocol (ports or files).