Share memory performance in Linux over windows (Synchronization overhead : Semaphore)
This post is regarding calculating the performance of share memory in linux over windows.
i am newbie to linux development. I have write client server application that calculates how many packets(size 2048 bytes) from share memory are transfered from client (process 1) to server (process 2) in 1 seconds. In windows i am using CreateFileMapping OpenFileMapping MapViewOfFile fuctions & for share memory synchronization i am using named events(createevent) in both client & server so that at a time read or write operation can be performed in share memory block. also i am using circular buffer inside structure as share memory block so it will became 512 share block of size 4096 struct block{ BYTE Data[4096]; long amount; } struct MemBuffer{ block m_Blocks[512]; ... ... } some sort of logic is implemented so that it will work as FIFO manner. Now In case of linux I am using posix share memory api shm_open ftruncate mmap share memory block is same (as mentioned above for windows) for synchronization semaphore is used i am using event based synchronization example : server is wait mode(sem_wait) when no data to read, client write data in share memory it raises event(sem_post) so server gets that event and start reading now when reader is reading that same share memory block write cant write in that block in my case i am using circular buffer so it get 512 block of data for read write so wait events should not occure all the time but i guess it is occuring thats why performance is not that good now performance windows count is 700000 packet per seconds linux count is 500000 packet per seconds using named semaphore linux count is 600000 packet per seconds using unnamed semaphore according my observation overhead in this whole application is synchronization so can anybody suggest me better approach for synchronization or how to improve overall performance of share memory in linux? I am using dual boot machine with windows 2003 server & Red Hat Enterprise Linux 6.0. machine configuration are as follows Intel Quad Core with 2.4 Ghz , 4GB RAM thanks in advance |
All times are GMT -5. The time now is 12:39 PM. |