Thanks Michel for your detailed response.
I am initialising the syslog engine.

var obj1 parser  = initalize()
var obj2 parser
go func() {
obj2 = initalize()
}()

if obj1 engine fails:
                go func() {
obj2.ReloadPattern(opts)
}()

My question is, will obj2.ReloadPattern reload the pattern on the second
syslog-engine , how can I verify that?Because I am not maintaining the
engine info. I am just having the parser object.
Will parser object obj2 go and reload the respective syslog engine that was
initialised by it? I guess yes, but still need clarification on this .

Since I was not able to identify the exact syslog engine, I was trying to
identify it using the processor.

Can we execute any linux command within goroutine to get some sort of info
on this ?

Thanks


On Tue, May 7, 2019 at 5:07 PM Michel Levieux <m.levi...@capitaldata.fr>
wrote:

> 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/CALjMrq7WK1vxSFwKB4eOtNWDTjfemG27ykGZ1-SghDtOuUqR_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to