--------------------------------------------
It's been a question for a long time,which is a better design approach.
Shared Memory ( Shared Memory is faster),
domain sockets(less problems,nearness to real life).
Shared Memory advantages
-----------------------------------
non-linear storage
will never block
multiple programs can access it.
Shared Memory disadvantages
------------------------------------------
need locking implementation
need manual freeing, even if unused by any program
Programs that crash in a critical region
Programs that spend too long time in the critical region
Locking too much
Distributed shared memory
Sharing limits scalability
Sharing can introduce deadlocks
Sharing makes systems error prone and debugging difficult
Sharing doesn't exist in the real world
Domain Sockets advantages
----------------------------------------
blocking and non-blocking mode and switching between them
you don't have to free them when tasks are completed
Domain sockets disadvantages
----------------------------------------
must read and write in a linear fashion
Finally Domain sockets are a lot easier to re-implement a distributed computing. The speed gain factor of Shared Memory will be lost because of the need of a safe design. However, with the use of proper kernel calls in a particular architecture,one can achieve greater speed with Shared Memory.
No comments:
Post a Comment