If the only thing you want to achieve is:

main:
run engineA
run engineB

engineA:
do something
if engineB is down -> run engineB

engineB:
do something
if engineA is down -> run engineA

You don't really need the two processes to run on different cores, nor do
you need them to be constantly running in parallel. You can just run both
engines in separate goroutines and trust the scheduler for their
management. Think of a goroutine as an abstraction. The goroutine is NOT a
thread, it is NOT bound to a CPU physical core at runtime (meaning it can
execute on any core, even on multiple ones in a single execution), the only
thing a goroutine does is decoupling the execution of a portion of code
from the other goroutines. I don't think you need to go deeper into the way
goroutines work to do what you're trying to achieve :)


Le mar. 7 mai 2019 à 13:02, Nitish Saboo <nitish.sabo...@gmail.com> a
écrit :

> Hi Jan,
>
> I need two separate parsing engines to be running and I feel that is
> possible when it is running parallel on two different cores.
> If operation on one of the parsing engine fails, I will reload the other
> parsing engine and do the operation.This is what I want to achieve.
> I thought goroutines will help me initialising two separate parsing
> engines.
>
> Thanks
>
>
> On Tue, May 7, 2019 at 3:09 PM Jan Mercl <0xj...@gmail.com> wrote:
>
>> On Tue, May 7, 2019 at 11:27 AM Nitish Saboo <nitish.sabo...@gmail.com>
>> wrote:
>>
>> > I want to initialise parsing engines on two different processors.
>>
>> Are goroutines meant where we read 'processors'? If not, than this
>> maybe is an XY problem[0] and please explain why you need distinct
>> CPUs to execute the code.
>>
>>   [0]: https://en.wikipedia.org/wiki/XY_problem
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANgi337UioNgx17HgnsOZ-%3DveffYbyKnHFZjG6QPVpKdHvGp%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to