Some methods of sharing data between programs
Assuming this is a medium to small sized game; not an Activision/Blizzard Entertainment AAA title.
Networking
The DarkNET plugin comes with examples of how to share data with TCP; you just need to use these examples to aid your effort to share between applications.
If your understanding of TCP is bad; why is it bad? Possibly because you've not yet learnt it. The DarkNET product is a great way to learn, let alone succeed.
Files
If your need requires
sharing a few bytes of data every half an hour or so or
if the data is a database then there is nothing wrong with using files[/i]; loads of programs including FPSC Editor; software created by the Valve Corporation and Microsoft use file sharing when performing a shared operation that need not upset any firewall or get into port forwarding on rear situations with fussy firewalls and routers. Usually for dealing with one off tasks every 10 minutes or so.
File Mapping
Microsoft created an information sharing process called file mapping.
Everybody who uses DBPRO has used file mapping sub-consciously every time they compile a DBPRO program.... This is how compile progress is shared between DBPCompiler.exe and your IDE... Everyone who uses FPSC has used file mapping sub-concuously when they build the arena/game; the progress is shared similarly.
Quote: "File mapping is the association of a file's contents with a portion of the virtual address space of a process. The system creates a file mapping object (also known as a section object) to maintain this association. A file view is the portion of virtual address space that a process uses to access the file's contents. File mapping allows the process to use both random input and output (I/O) and sequential I/O. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory. "
article
DBPRO has file mapping commands as a standard
Quote: "WRITE FILEMAP STRING : WRITE FILEMAP STRING Filemap Name, String
WRITE FILEMAP VALUE : WRITE FILEMAP VALUE Filemap Name, Value
READ FILEMAP STRING : Return String=READ FILEMAP STRING(String Value)
READ FILEMAP VALUE : Return DWORD=READ FILEMAP VALUE(Filemap Name)
"
Rem Application One
Write Filemap String "MySharedDataviewName", "Hello World"
Repeat
Wait 1000
Sync Sleep 2
Until Read FileMap String("MySharedDataviewName") = "Done"
Write Filemap String "MySharedDataviewName", ""
Rem Application Two
Repeat
Wait 1000
Sync Sleep 2
Until Read FileMap String("MySharedDataviewName") <> ""
Print Read FileMap String("MySharedDataviewName")
Write FileMap String "MySharedDataviewName", "Done"
This is pretty good for easy database sharing, as stated in the definition; it maps small chunks of data into RAM as and when such data is needed; so this is good for sharing of large file processing; but is also handy for one off operations in small EXEs if you do not want to make network port connections and have the user prompted to allow network accesses just to do something small.
Windows Messages
Again; everybody who uses any Windows program which communicates with another window, such as Microsoft Office, Windows Presentation Foundation (Vista, 7 & 8 interface features), ActiveX and to a degree Dark GDK. NET has used Windows messages frequently.
Pretty much every keystroke made to write this post is a command sent via a windows message. You can also use windows messages to send information to any user control or window.
At the moment, the easiest method is to use Styx or a windows GUI plugin such as BBB GUI using window text or properties. But the fastest way is not as easy; you need to use the custom window message handle using API's:
Quote: "Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function."
SendMessage API reference
Mutex (Shared memory banks)
Michael said
Quote: "shared memory in Windows actually uses the page file so is as slow as writing to hard disk. This might not be true, needs some confirmation."
When I use this the hard drive light does not come on; hopefully it is not true. However, here is a
thread about using Mutexes and shared memory banks.
This closely resembles your idea:
Quote: "Second idea was to write and read memblock (memblock can be write and read from each the EXEs)"
However you need Matrix1, and you would use Memory Banks. I've used this to get my character editor to talk to my engine.
I really would to use all my little sweet cores!
Do consider what Mobius stated, but also consider this.
Having two EXEs will not guarantee two seperate cores; you have no control over this it seems. Consider using other types of optimization in combination with having two exes. I'd suggest using one EXE for the game, and the other for updates, installation, advanced GUI and loading screens.
Most video games in the industry do not need multi-cores to run smooth; but sometimes it is good to still be able to use a program whilst something intense such as loading a huge object is being performed; your idea can work, but only if you do your research. You will need to sleep the CPU in each EXE once and a while to share some of the CPU usage between them.
Another way to organize you program overhead is to make good use of the GPU by using shaders. But even more so; research is required to stipulate what kind of calculation is suitable for a GPU shader script, and what is better suited in hard code.