Asynchronous and multi-threaded programming in MQL - page 13

 
Реter Konow:

If they add multithreading, will it make you feel worse? And so they added a lot of things to MQL, and it's a really useful thing. But its usefulness can be understood only by a person, who writes very complex, cumbersome programs in MQL. If you do not understand what the multi-threading is for, it means that you don't write such programs. When you do, you will understand. It's very simple. ))

Multithreading is definitely needed, especially in tester, especially in multi-instrument mode. I'm often lacking performance. But I'm not an expert in programming and I don't understand the subtleties very well, I only know that I need to count many things in parallel). And paralleling the tester would be extremely useful.
 
Реter Konow:

If they add multithreading, will it make you worse?

definitely not - it will be better, ! - BUT the key question here is support - who will explain how to use it? - Who will fix bugs? - Who will provide guaranteed understandable functionality?

According to the basic idea of developers how and who to use MT, they provide functionality corresponding to C++, thereby removing the "headache" of training and explaining how it works - the literature on C++ and examplesof writing entry levelprograms on the web for 20 years has collected a lot

Have you seen a ready-made package (according to TC's problem) that would be applied to C++?

 
Igor Makanu:

"experts"? - You have nothing to talk about, shove your imho... You have a big MQL community on this site with professionals in different fields, unfortunately, you haven't shown any of your knowledge that would be useful to the community, you can blame me again for anything you like - "you're the expert! "


Developers will do? - You can't explain even WHY it's needed, can you? )))

what is the purpose of MetaQoutes? - the goal, as any IT company to make a profit! i don't know why, MetaQoutes is very serious about promoting its services, a lot of work is done to popularize algorithmic trading, to give analytical material, to create an online community... this kind of charity only a few IT companies do, usually the IT giants

so, the company spends its resources on something which in the future (not sure) will make a profit.... and then, lo and behold... a user comes along who needs to adapt the concept of retarded Python or Java to MQl.... Don't you think it's funny? - how old are you? ))))


I respect that persistence is often the only way to find your niche in life! Good luck in this hard work!

There is nothing to talk to you about on this topic!
You don't even have enough logic to understand what effective benefit MetaQuotes will get from being able to write asynchronous programs.
And it will really attract specialists, who write asynchronous programs.
And there are enough adequate specialists in the community, with whom you can discuss problems and ideas, and not listen to your "I am a specialist".
Alas, to be an expert, you need to keep up with the technology, no matter what language it is used in.
You don't even hear what you're told that C++ is also written asynchronously, but you probably don't understand it, you haven't set yourself asynchronous tasks.
And let's moderate your ardour, you can't even communicate normally.

 
Roman:

You're the one with nothing to talk about on this topic!

don't talk, but there is still no answer:


answer the question why does the trading terminal need it?
 
Maxim Romanov:
Multithreading is definitely needed, especially in tester, especially in multi-instrument mode. I often lack performance. But I'm not an expert in programming and I don't understand the subtleties very well, I only know that I need to count a lot of things and in parallel). And paralleling the tester would be extremely useful.
And I'm going to develop three-dimensional visualization, and it's not reasonable to put it in one thread with calculations, interface events, external events (server calls). The DLL is not suitable always for one reason - you can't freely distribute programs.
 
Igor Makanu:

definitely not - it will be better, ! - BUT the key question here is support - who will explain how to use it? - Who will fix bugs? - Who will ensure that functionality is guaranteed to be understandable?

...

From my point of view, this is the least of the problems. The main thing is that people will communicate on this topic. The forum needs new topics. Isn't it? It's only going to get better. Well, what will be critical if there are problems and bugs among users? And when there weren't any? )

 
Andrey Pogoreltsev:

You demand asynchronous query execution but cite multithreading as an example... I urged you to figure it out, but you never did.

I gave you a solution to your exact problem here: https://www.mql5.com/ru/forum/318593/page4#comment_12568119

But I'm sure you haven't even studied the topic.

Seems to me, if you give you an asynchronous queue, you'll still ask for multithreading... At least try to deal with OVERLAPPED and events for a start, aren't you asking WinAPI into your code).

If you introduce multithreading into the terminal, it will bury itself from woeful programmers, faster than the speed of light.

Programmers are looking for solutions to problems, not asking the framework to change to suit their ignorance.

No, you're wrong, I've looked at it all and will definitely look into it.
By the way, you are the only one who gave at least some good direction thank you, from the rest only flub.
There are just a lot of people who don't understand the essence of the topic, that's why I had to answer their questions. That's why I had to answer their questions. That's why the topic got bigger.
There are several technologies for multithreading or asynchronous connection, that's why so many of them don't understand it.
And I had to hastily give samples from the Internet but even they at least somehow explain the essence of the technology.
No one bothered to show other technologies and explain how they work, one chorus.

 
Roman:

No no, you are wrong, I looked it all up, I will look into it unequivocally.
By the way, you are the only one who gave at least some true direction thank you, the others only flub.
There are just many people who don't understand the essence of the topic, that's why I had to answer their questions. That's why I had to answer their questions. That's why the topic got bigger.
And about multithreading or asynchronous connection there are some technologies, that's why many have no understanding.
And I had to hastily give samples from the Internet but even they at least somehow explain the essence of the technology.
No one bothered to show other technologies and explain how they work, one chorus.

Multithreading - tasks run in multiple threads. Can run on a single processor, still multithreading and switching between them as processor time quotas run out. Requires synchronization for access to shared resources. Can lead to deadlocks, race condition,memory release bugs and other "surprises".

Asynchronous - non-blocked function execution (i.e. control is immediately returned after method exit), usually on other devices (networking equipment, storage devices, peripherals, etc.). For example, it is possible to write a high-performance multi-user server using only one thread and end-machine processing client connections. It all depends on the purpose of this server.

In your case you need to create a large number of connections using WinAPI and you can check the state of these connections through WaitForMultipleObjects with a timeout, so you don't keep a timer thread, for example.

PS. Theoretically, IOCompletionPort could also be used, but it requires more knowledge and careful design.
 
Andrey Pogoreltsev:

Multithreading - tasks run in multiple threads. Can run on a single processor, still multithreading and switching between them as processor time quotas run out. Requires synchronization for access to shared resources. May lead to deadlock, race condition, memory release errors and other "surprises".

Is it really all that dangerous? Errors in memory release... However, Expert Advisors run on different charts in different threads and there are no unexpected failures. So, tasks distributed between EAs will not cause critical errors, but tasks distributed between threads inside one EA will? Of course, I'm not an expert in these matters, but what is the problem with moving the method of tasks distribution among EAs into a single EA? Perhaps there is a problem, I do not argue.

 
Andrey Pogoreltsev:

Multithreading - tasks run in multiple threads. Can run on a single processor, still multithreading and switching between them as processor time quotas run out. Requires synchronization for access to shared resources. Can lead to deadlocks, race condition, memory release bugs and other "surprises".

Asynchronous - non-blocked function execution (i.e. control is immediately returned after method exit), usually on other devices (networking equipment, storage devices, peripherals, etc.). For example, it is possible to write a high-performance multi-user server using only one thread and end-machine processing client connections. It all depends on the purpose of this server.

In your case, you need to create a large number of connections using WinAPI and you can check the state of those connections with WaitForMultipleObjects with a timeout, so you don't have to hold a timer thread, for example.

PS. Theoretically, you could also use IOCompletionPort, but it requires more knowledge and clear design.

Now, that's a conversation, I've done non-blocked execution with asyncio, but if you write the word coroutine or calback here, there's a lot of confusion and I'd rather not say anything ))
I know the principle of non-blocking calls myself, but only in python and one more C and C++ library.
I've never worked with WinAPI, I will study it, I was looking at other libraries, but it makes no difference, the main thing is to understand syntax, and I understand what's what there )))
But during conversation I suggested to add such functionality to regular mql, to enable writing asynchronous code out of the box.
And we started to get confusion because we did not understand what for and why. Because it's because ))