[Operating System] {ud923} P3L3: Inter-Process Communication

 

 

 

 

Visual Metaphor

 

 

 

Inter Process Communication

 

 

Message Based IPC

 

 

 Forms of Message Passing

 

 

 

 

 Shared Memory IPC

 

 

 

 

 Copy vs. Map

In windows:

(1), data size smaller than a threshold => copy

(2) othersiwe => copy to page aligned area and map

 

 

 

 

SysV Shared Memory 

 

Segments will be removed only when it's explicitly deleted or the system reboots

Whereas the regular non-shared memory that is malloced will disappear as soon as the process exists.

 

 

 

 SysV Shared Memory API

 

 

 https://www.tutorialspoint.com/inter_process_communication/inter_process_communication_system_v_posix.htm

 

 POSIX Shared Memory API

http://man7.org/linux/man-pages/man7/shm_overview.7.html

 

 

 

 

Shared Memory and Sync 

 

 

 

 

PThreads Sync for IPC 

 

Sync data be shared and visible to both processes.

 Here, system V api.

 

shmget(fork(segmentation_id, integer parameter), segment_size, area_permission)

  segmentation_id => shared memory identifier => uniquely created from token operation => with arg[0] from command line

  integer parameter => 120 here

  segment_size => 1024 => 1KB

   return seg;

shmat(seg, ...)

  return shared_memory_address;

 

 

 

IPC Resources

 

 

 Sync for Other IPC

 

 

 

 

 

 https://www.geeksforgeeks.org/ipc-using-message-queues/

 

 

 

IPC Command Line Tools

 

 

 

 Shared Mem Design Considerations

 

 

 

 

 How Many Segments?

 

 

 

 Design Considerations

 

 

 

 

 

posted @ 2019-05-25 03:49  ecoflex  阅读(211)  评论(0)    收藏  举报