--- In [email protected], "ajinkyakale_86" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I want to make to C programs execute simultaneously.... > One instruction by one program and next by other. > I basically want to swap continuously bet the programs... > > I dont have any knowledge of concurrent programming in C. > Can anyone suggest me a good starting point?
As Victor already pointed out, concurrent programming is not at all part of C or C++. Something like "one instruction on CPU1, the next one on CPU2" is not feasible without extremely huge efforts. What you might want to look at are threads. Threads are (roughly spoken) a means of splitting up one process into several threads of execution; those threads all have their own processor stack (on CPUs which support a stack) but share code and global variables. So in order to access global variables you will need some sort of synchronisation mechanism. There are basically two sorts of threading libraries, namely user-mode threading (SCO Unix was the most prominent representative of this group) and kernel-mode threading (BSD, Linux, many others). Both have their advantages and disadvantages, but usually you will have only one of them on any given system. But that's beyond the scope of your question. Could you please let us know what exactly you want to achieve? Then we might be able to tell you whether threads are what you need and mean. Regards, Nico
