0% found this document useful (0 votes)
21 views

Exchange Data More Quickly!

The document describes a method for clients and servers to exchange data using shared memory. The client writes data to shared memory, resets a semaphore to signal the data is ready, and the server then reads the shared memory and can modify the data. Key steps include the client getting access to shared memory, writing data, resetting the semaphore, and the server reading the shared memory and being able to write back to it.

Uploaded by

Breban Sergiu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Exchange Data More Quickly!

The document describes a method for clients and servers to exchange data using shared memory. The client writes data to shared memory, resets a semaphore to signal the data is ready, and the server then reads the shared memory and can modify the data. Key steps include the client getting access to shared memory, writing data, resetting the semaphore, and the server reading the shared memory and being able to write back to it.

Uploaded by

Breban Sergiu
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

EXCHANGE DATA MORE QUICKLY!

SERVER

CLIENT

MODIFY
DATA

PUTTING DATA IN SHARED MEMORY


1. The Client gets access to shared memory after
checking a semaphore value
2. The Client
writes the
data

3. The Client
resets the
semaphore

The Server writes data


back to the shared
memory

DATA IS WAITING!

DATA IS
READY TO BE
READ

Write something
into the shared
memory

Define
the size
of the
shared
memory

We want to get the pointer


to the end of the string
Add null at the end of the string

The function
to create the
shared
memory

The Server will


wait one second
while checking for
*
Set up
permission

Attaches the shared memory segment


identified by shmid to the address
space of the calling process

It will read the content


of the shared memory
and print it

It will change the first


character into the
shared memory with *
because the server is
waiting

You might also like