AutoHotkey Community

It is currently May 26th, 2012, 6:41 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Virtual Memory Problem
PostPosted: March 10th, 2008, 1:04 am 
Offline

Joined: October 26th, 2005, 5:11 pm
Posts: 28
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/viewtop ... highlight=

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?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 10th, 2008, 8:33 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2008, 9:47 am 
Offline

Joined: October 26th, 2005, 5:11 pm
Posts: 28
Why the damn hell do I always get so pissed reading these responses? :D :D :D :D :D :D :D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: JSLover, kkkddd1, Tipsy3000, Yahoo [Bot] and 80 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group