Assignment

N

nrajeshkumars

Guest
write a server program that accepts the input to generate the Fibonacci sequence and puts that number accepted from command line in the shared memory. Also write a Client program accesses the number from shared memory and generates the Fibonacci sequence.

The shared memory should have two integer variables (Hint: Define a struct with these two int variables), one is status and the other is fibCount which stores the numberto generate Fibonacci sequence. Variable status should have the value DATA_NOT_FILLED (-1) if the shared memory has not yet been filled with fibCount, DATA_FILLED(0) if the server has filledfibCount in the shared memory, and DATA_TAKEN(1) if client has taken the fibCount in shared memory. Once client accesses the shared memory and receives the number and generates the Fibonacci sequence as in programming assignment 1, the status should be changed toDATA_FILLED, and then the server detaches and removes the shared memory.

Hint: Define DATA_NOT_FILLED, DATA_FILLED and DATA_TAKEN as constants with the values -1, 0 and 1 respectively.
 


Top