220 likes | 555 Views
IPC: Shared Memory. By: Jonathan Pingilley. Shared memory is an efficient way of passing data between two programs on the system or cluster. A program will basically create a portion in memory to which another program can access if it is permitted by the other process or application.
E N D
IPC: Shared Memory By: Jonathan Pingilley
Shared memory is an efficient way of passing data between two programs on the system or cluster. • A program will basically create a portion in memory to which another program can access if it is permitted by the other process or application. • Memory is mapped into address spaces of a particular process’s sharing memory area. • A form of synchronization is required Fastest Form of IPC
Process explicitly asks for an area, using a key, to be shared with another process. • This is the Server process. • All other processes are the clients. (since they know It and can access it) • Note: Conserves memory space by directly accessing the thing that would normally be copies of a piece of information.
POSIX and Windows Utilized http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/images/Chapter9/9_24_WindowsSharedMemory.jpg
Contains Processes & Threads • Process: execution of a program • Threads: lightweight processes • Our Goal: Be able to allow an application access something in which another application has produced or has stored in memory. Interprocess Communication
Windows has mechanism for allowing communication and data sharing between it’s applications. • These Interprocess Communications are what help facilitate communication on a given computer or network of computer(DS). Local Machine/Remote Machine Applications
Client Server Application or process that responds to that clients requests. • Application or process which requests a service from another application or process Client or Server or Both?
Should the application be able to communicate with other applications running on other computers on a network, or is it sufficient for the application to communicate only with applications on the local computer? • Should the application be able to communicate with applications running on other computers that may be running under different operating systems (such as 16-bit Windows or UNIX)? • Should the user of the application have to choose the other applications with which the application communicates, or can the application implicitly find its cooperating partners? • Should the application communicate with many different applications in a general way, such as allowing cut-and-paste operations with any other application, or should its communications requirements be limited to a restricted set of interactions with specific other applications? • Is performance a critical aspect of the application? All IPC mechanisms include some amount of overhead. • Should the application be a GUI application or a console application? Some IPC mechanisms require a GUI application. How do we decide on a method? http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx
ClipBoard • Data Copy • Pipes • RPC • Windows Sockets • ETC. IPC Supported by Windows Images: http://www.google.com/imgres?um=1&hl=en&rlz=1C1LENP_enUS490US490&biw=673&bih=622&tbm=isch&tbnid=dQQbSUNMFfs5-M:&imgrefurl=http://opi.clients.squiz.co.uk/past_events/european_op_awards_2009/categories%3FSQ_DESIGN_NAME%3Dprint&docid=zNB1PyFoM0GqxM&imgurl=http://opi.clients.squiz.co.uk/__data/assets/image/0018/105318/m-real_data_copy_logo_for_web.gif&w=425&h=304&ei=BFVSUI6KCdLH0AGQ1oGwDw&zoom=1&iact=rc&dur=360&sig=109236956160461677199&page=1&tbnh=121&tbnw=169&start=0&ndsp=12&ved=1t:429,r:2,s:0,i:79&tx=84&ty=52, http://www.google.com/imgres?um=1&hl=en&sa=X&rlz=1C1LENP_enUS490US490&biw=673&bih=622&tbm=isch&tbnid=ttEke_rmCSFgbM:&imgrefurl=http://www.apexpipe.com/&docid=pyY5YKgjQB53eM&imgurl=http://www.apexpipe.com/sitepics/k%25252012%252520std.jpg&w=640&h=480&ei=5FRSUMr7NO650AH4goCABA&zoom=1&iact=rc&dur=299&sig=109236956160461677199&page=1&tbnh=117&tbnw=154&start=0&ndsp=12&ved=1t:429,r:0,s:0,i:139&tx=65&ty=67, http://msdn.microsoft.com/en-us/library/windows/desktop/ms740650(v=vs.85).aspx
Central depository among applications. All apps must support the clipboard IF applications aren’t somewhat identical, a universal “standard” between the two must be made. * Rich Text format. Clipboard for IPC
What happens when an application doesn’t understand the format? • One would need to register a private format (to be sent to the clipboard) • The target application or process could then attempt to read the format.
Because of the different formats supported, • The rendering of data in certain applications can be delayed. • The data placed in a clipboard is rendered in many different formats to help with this problem. (Clipboard tries to find a particular format while the information is being placed). Delayed Rendering