IPC Programming Solution

$30.00

Description

Introduction

Inter-Process-Communication (or IPC for short) are mechanisms provided by the kernel to allow processes to communicate with each other. There are two typical IPCs (message que, shared memory). IPC Keys To obtain a unique ID, a key must be used. The key must be mutually agreed upon by both client and server processes. This represents the first step in constructing a client/server framework for an application. The key can be the same value every time, by hardcoding a key value into an application. This has the disadvantage of the key possibly being in use already. Often, the ftok() function is used to generate key values for both the client and the server. LIBRARY FUNCTION: ftok();

PROTOTYPE: “`key_t ftok ( char *pathname, char proj )“`; RETURNS: new IPC key value if successful -1 if unsuccessful, errno set to return of stat() call

The returned key value from ftok() is generated by combining the inode number and minor device number from the file in argument one, with the one character project identifier in the second argument, pathname (**which must refer to an existing, accessible file**).

Specification

The requirement for this assignment is to transfer a message from a process to another using SharedMemory or Message Que.

To create an IPC key, create a file “`CS230“` first and then use your project id to obtain the key.

Try not to be tricky to avoid penalizing, you code should be clear. Read the comment in skeleton carefully.

Output example

“`

Generated key is: -481388518

Data written in memory: 123456

Generated key is: -481388518

Data read from memory: 123456

Generated key is: -481388518

Data written in memory: 888888 99

Generated key is: -481388518

Data written in memory: 888888 99

“`

Evaluation

Your score will be computed out of a maximum 80 points with several test cases. We will evaluate your score on elice evaluation system. If you copy codes from internet or from other students, you will get 0 points.


error: Content is protected !!