One process will be invoked many times by external process to create multiple tasks.
First it will check No.1 task if it is free it will assign the job to process else it will create No.2 task and goes on for N tasks.

In order to synchronize, I need to keep the data of the process ( time created and process id, etc. ) in a temporary memory and reset the data after completion. If 2nd process is invoked it will check No1 task data, it is already in processing it will go and create No2 task else it will assign to No1 task.

what will be best way to implement this ?
please let me know if it is not clear.

if the tasks are different processes i nevertheless would use a similar concept. you either pass the information when the processes were created - for example by commandline arguments- or if the client processes can be used for different tasks - you do some program-to-program communication (see also comment of Subrat), where windows messages probably are the easiest way though they require at least a pseudo window and message loop for each participant.

you can use the same code for write and read. in case of reading you might check after CreateFileMapping successfully returning a handle that GetLastError() returns ERROR_ALREADY_EXISTS cause the reading process should be second after the writing process.

alternatively the client processes may use OpenFileMapping as described in

registry entries rarely are used for p2p (too slow). it is recommendable for properties or settings, though. so shared memory is fine for client-server on one machine. you could have a big structure which has a separate section for each participant. that way each side could write to its exclusive space in memory. you only would need to lock read and write operations by a named mutex if the information was updated periodically. if the data is more a constant which is not a matter of change the registry approach jkr has shown is more simple and allows you an easy external update by using regedit.

in both programs you need to add a wait such that the "server" and "client" both can keep up holding a handle on the shared memory. when there is no program which has an open handle to the shared memory, windows will free the space.

you should turn both the projects from 'using precompiled headers' to 'not using precompiled headers' both for debug and release configuration. for that you would remove stdafx.cpp from project tree (you can only remove or delete it that makes no difference) and then go to configuration properties - c/c++- precompiled headers and change the 'precompiled header' option. precompiled headers is a compiler speed optimization which don't make so much sense for non-mfc projects and even for those it could make more problems as it helps. also I would recommend to change the character set from UNICODE to 'Multibyte' in the configuration properties - general (again both for debug and release). if you do so you could forget all the TCHAR/wchar_t, _T/L"", LPCTSTR, LPTSTR, _tmain, -tprintf stuff and use char, "", const char*, char *, main and std::cout instead:

the client would be made similar. you would start the server first and then the client. both programs would print the success message on the screen and wait for input. you can stop the scenario by inputting a number to either program.

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…

The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.