Inter Process Communication

As an Epitech student I had to become an amateur videographer, a draw my life maker, now I have to become a journalist so be kind this is my first article !

In computer science, inter-process communication or interprocess communication (IPC) refers specifically to the mechanisms an operating system provides to allow processes it manages to share data. Typically, applications can use IPC, categorized as clients and servers, where the client requests data and the server responds to client requests. Many applications are both clients and servers, as commonly seen in distributed computing. Methods for achieving IPC are divided into categories which vary based on software requirements, such as performance and modularity requirements, and system circumstances, such as network bandwidth and latency. Cf; Wikipedia

LemIPC, our first project with the IPC.

Lemipc is a game played on a two dimentonal board, you have to fight several team players, the last team player on the board is the winner of the game.

To kill a player, a minimum of two players from the same team (and different from the first) need to be in contact with the player to kill. It means on a square next to the one where the player you want to kill stands on. (including diagonally).

To do so we had to use new notions:

The Shared memory:

In computer science, shared memory is memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Shared memory is an efficient means of passing data between programs. Depending on context, programs may run on a single processor or on multiple separate processors. cf. Wikipedia

Semaphores:

a semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multiprogramming operating system.
A trivial semaphore is a plain variable that is changed (for example, incremented or decremented, or toggled) depending on programmer-defined conditions. The variable is then used as a condition to control access to some system resource.

Few diagrams to illustrate the goal of the projet

Yes, this is a handmade diagram…

On this first diagram we can see two Ai preparing for fight in the arena, red team vs yellow team. (Go Monaco !)

After few turn.

Here the green dot (initally yellow but it’s easier to explain with other colors) is dead because two dot from the red team are next to him.

Our game:

The idea was to create a shared memory containing the board when we first launch our program:

The board is ready, he’s waiting for two teams to start the game.

When the board is created we have to launch our players, the program knows with the return of the shared memory created that we already launch one time our game.

Two teams are now fighting.

When two teams are launched, the board is displayed on the screen, we can let the fight begin.

On a really basic Ncurses display, the team number.

Finally when there is one team remaining on the board, we can tell the winner and delete our Sempahore and our shared memory.

To conclude:

This first IPC projet was very interesting, probably one of the most. The notion was really good.

I wish i had more time to introduce message queue and a good AI.

The problem of this project and that it’s just make no sense to fight the same AI in a game. Hope you find something for that Epitech !

Finally I want to thanks my partner, Alexandre Corvino, who gave a huge contribution to this projet. Thank you budy !

Thanks !

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.