Actually I am developing a software for college competition(Just like Core War ..if you know)
In this competition two participants will have there own code for the next moves of a game(eg: battleship or Othelo or may be Chess...but chess is too diff!) My software will form the base for the game. It will execute moves from the 2 participants' code alternately. Basically the aim is two play game between two C programs which have different algorithms for their next move.(I hope you got my point) Ciao, Ajinkya. ----- Original Message ---- From: Nico Heinze <[EMAIL PROTECTED]> To: [email protected] Sent: Sunday, 22 April, 2007 12:30:01 PM Subject: [c-prog] Re: concurrent C programming --- In [EMAIL PROTECTED] com, "ajinkyakale_ 86" <ajinkyakale_ [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 Send a FREE SMS to your friend's mobile from Yahoo! Messenger. Get it now at http://in.messenger.yahoo.com/ [Non-text portions of this message have been removed]
