Asynchrony is designed to relieve the processor from waiting

TG Database is a platform for organized data management.
Post Reply
nusaibatara
Posts: 162
Joined: Tue Jan 07, 2025 4:34 am

Asynchrony is designed to relieve the processor from waiting

Post by nusaibatara »

Each thread can run independently of the others, allowing for more efficient use of computer resources and increasing program responsiveness, an example of multithreading in JAVA: Multithreaded JAVA But 1C doesn't work like that. It is important to note that asynchronicity in 1C does not imply multithreading. Since 1C is a "conditionally" single-threaded language (based on our research) Single-threaded 1C ITS doesn't say anything about this, but to prove this statement, it is enough to launch Process Explorer and try to load it with any operations in the built-in language, you can see that only one thread is loaded. Some argue that it is possible to achieve the work of two threads by using the built-in browser "WebKit", but even if you load the built-in browser (for example, with an infinite loop in JS), the tasks are placed in the stack of one thread.



Process Analysis Asynchrony in mexico phone number list 1C does not speed up code execution? , for example, while 1C is waiting for a response from the site, another task from the stack can be executed at that moment, this really gives a speed increase. But, at the time of writing, in most new constructions ending with "Async", they do not provide any acceleration - this is syntactic sugar (ease of writing code, examples are shown at the beginning of the article). Nobody knows how 1C works from the inside, one thing is clear, that 1C is a stack language, accordingly it adds all operations to the "stack" on top of the stack, then executes operations one after another, therefore even when the effect of "multithreading" is created, in any case on the client part of 1C everything is queued and nothing will be executed at the same time, only one operation at a time (with the exception of operations that are not processed by 1C, for example, preparing a response from the server when using an http request, in this case 1C will take another operation for execution and will not be "idle").



To prove the above statements, we will show the classic scheme of the "event loop" in JavaScript, for stack languages ​​the scheme will be similar, so we will immediately transfer it to 1C: Asynchrony in 1s What happens if there is a heavy synchronous operation in the stack? The picture below shows that at this moment we cannot click anything in the interface, we see the loading icon near the cursor. Example of a difficult operation And what if the method is asynchronous? In this case, the task will be divided into two parts, and while the remote server processors are strained, our processor performs other operations Description of the problem A common situation: we need to transfer a 1C software license to another computer, but we have nothing to transfer.
Post Reply