 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
q335r49
Joined: 26 Oct 2005 Posts: 17
|
Posted: Mon Mar 10, 2008 12:04 am Post subject: Virtual Memory Problem |
|
|
Here is the problem. You have N scripts, where N is a large number, all wanting to talk to each other. They talk to each other very fast, so you do not want to write to file. How is this possible? Well, you would need a virtual memory. One option is the terminal script: http://www.autohotkey.com/forum/viewtopic.php?t=4972&start=0&postdays=0&postorder=asc
There are various shortcomings. For example, memory should be assigned dynamincally, and it needs a public name. One should be able to declare public "Names" of files or communication channels in virtual memory, space is dynamically allocated, so that two scripts can refer to memory by name rather than by the address. It should be able to handle cases when memory is full. Also, there are some overheads involving ControlGetText, etc. In actual practice, the terminal script would work just fine, simply because of the overall speed of ahk scripting.
But, there should be a better, or at least more elegant way: some way that would solve the theoretical problem of 300 scripts wanting to communicate very fast with one another.
(1) I want dynamically allocated memory. In that case, I can simply have an edit box hold a list of names and addresses, so that's easy.
(2) I want to eliminate the GUI overhead. Well -- I can use clipboard. Have one huge string in the clipboard, of the form:
Name1 Index1 Length1 Name2 Index2 Length2 .... File1 File2 File3 ...
The first part of the string is a file allocation table. Filereads would just look up the file in the index and take the substring from there. It would be accessible to every script, and it would obviate the need for writing to actual files on disk.
However, this is good only for short files, as we do not have access to fast string functions, making manipulating large strings to be unwieldly, at present. For example, it seems that, just to change an index, using the scripting language, you would have to either rebuild the string from scratch or use the cumbersome stringLefts, etc.
Questions:
1)Are there any other implementations of virtual memory, besides the clipboard and the gui?
2)Are there ways to have fast string functions, such as pointers to strings indices, so that we can use overwrites rather than string append, etc.? (And we would face the problem, then, of fragmentation -- but that can be solved later.) Probably memory operation on a lower level than ahk was intended for? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2737 Location: Australia, Qld
|
Posted: Mon Mar 10, 2008 7:33 am Post subject: Re: Virtual Memory Problem |
|
|
| q335r49 wrote: | | 1)Are there any other implementations of virtual memory, besides the clipboard and the gui? | Variables? I think the issue is not storage, but accessing one script's storage from another script. In other words, what you should research is different methods of inter-process communication. For example, you could use majkinetor's IPC module or TCP/IP.
| Quote: | | 2)Are there ways to have fast string functions, such as pointers to strings indices, so that we can use overwrites rather than string append, etc.? | AutoHotkey string operations are already fast. Assigning or appending to an AutoHotkey variable does not perform any memory allocations unless the variable's current capacity is too low. I'm not sure why you'd think fragmentation would be an issue...
| Quote: | | Probably memory operation on a lower level than ahk was intended for? | AutoHotkey has access to the same set of memory management (and inter-process communication) API's as most other programs, via DllCall.
| Quote: | | One should be able to declare public "Names" of files or communication channels in virtual memory, | You could perhaps use mailslots or pipes. See MSDN: Interprocess Communication. |
|
| Back to top |
|
 |
q335r49
Joined: 26 Oct 2005 Posts: 17
|
Posted: Mon Mar 10, 2008 8:47 am Post subject: |
|
|
Why the damn hell do I always get so pissed reading these responses?  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|