Paste Method Atitit cross-process communication path parameter method Contents 1. .IPC (Inter-Process Communication, inter-process communication) 1 1.1 .IPC usage scenarios: 2. Conventional 2-pass process

Atitit paste the path parameter method cross-process communication method

 

 

table of Contents

1. .IPC (Inter-Process Communication, inter-process communication) 1

1.1 .IPC usage scenarios: 2

2. During the conventional processes, a substantially communicate the following categories: 3

3. Inter-process communication 3

4. Jvm 4

4.1. IPC can be used Rmi, or Corba can. 4

4.2. Memory-mapped files to implement inter-process communication (shared memory). 4

4.3. Queue 4

5. Multi-mode process the following problems: 4

6. Ati common 4

6.1. Clipboard sharing files vs 4

7. The communication between threads 4

7.1 thread communication: 5

8. ref 5

 

 

  1. .IPC (Inter-Process Communication, inter-process communication)

Any IPC mechanism has a corresponding operating system.

  • Windows: inter-process communication via the clipboard, pipes, tanks and so on.
  • Linux: the namespace, share content, such as semaphores interprocess communication.
  • Android: not fully inherit Linux, for example, has its unique way of communication Binder, Socket and so on.

Communication is the spread, or the exchange of information between different processes, different processes that exist between the two sides interprocess what the media can access it? Process user space are independent of each other, is not generally accessible to each other, the only exception is the shared memory area. In addition, system space is "public places", the processes can be accessed, so the kernel can also provide such conditions. In addition, both sides have access to peripherals. In this sense, of course, the two processes can exchange information by ordinary file on disk, or through some entries and records "Registry" or other databases to exchange information. This is also a broad inter-process communication means, but these are generally not counted as "inter-process communication."

    1. .IPC usage scenarios:
  • For some reason, the application itself need to adopt a multi-process model to achieve. Possible reasons are:

          Some modules for special reasons to run in a separate process;
          to increase the memory an application that can be used, the need to obtain multiple copies of the memory space by multiple processes.

  • Current applications require data to other applications.

 

: Why the need for IPC? Multi-process communication may be what will happen?

Why A multi-process?

In the Android system a default application that only one process, each process has its own independent resources and memory space, other processes can not access any memory and resources of the current process, will limit the system memory allocated to each process. If a process memory exceeds the memory limit, will report OOM problem, many frequent operations related to the big picture, or need to read a large section of data in memory, it is easy OOM reported problems, in order to thoroughly solve the problem of application memory, Android introduces the concept of multi-process, it allows some of the pages within the same application, in order to relieve the pressure on the main process will take up memory to open a separate process, such as Flash, video playback page, frequently draw pages, etc.

---------------------

 

 

  1. Traditional way communication process has substantially the following categories:



(1) pipe (the PIPE)
(2)  named pipe (the FIFO)
(. 3) semaphore (Semphore)
(. 4) message queue (the MessageQueue)
(. 5) shared memory (SharedMemory)
(. 6) the Socket

 

 

  1. Interprocess communication

1. Line (anonymous pipes Pipe) // PipedInputStream, PipedOutputStream

 

2. Named Pipes (NamedPipe / FIFO) // java does not support?

 

3. The signal (Signal) // wait () notify () notifyall (), the tube

 

4. Message Queue (the MessageQueue)

 

5. Shared Memory (SharedMemory) // java does not support?

 

6. The memory mapping (MappedMemory)

 

7. semaphore (Semaphore) // appreciated atomic operations, but also for safety reasons why the semaphore

 

8. socket (Socket) // should all be familiar with

---------------------

  1.  Jvm
    1. IPC can be used Rmi, or Corba can.

In addition Java nio of MappedByteBuffer can also

    1. Memory-mapped files to implement inter-process communication (shared memory).
    2. queue
  1. Multi-process model the following problems:


1, static and singleton complete failure
2, thread synchronization mechanism completely ineffective
3, SharedPreferences reliability decreased
4, Application repeatedly created

  1. Ati common
    1. Clipboard vs shared files

namesxls= (String) ( (Transferable) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null)).getTransferData(DataFlavor.stringFlavor);

 

  1. Communication between threads

① Synchronization

Speaking of the synchronization means multiple threads to communicate between threads through the synchronized keyword in this way

②while polling way

③wait / notify mechanism

④ communication pipe is used for communication java.io.PipedInputStream and java.io.PipedOutputStream

Specific not introduced. Distributed system, said two communication mechanisms: shared memory mechanism and message communication mechanism. Feeling while polling in the previous ① and ② in the synchronized keyword "belong" to the shared memory mechanism, as is the condition of polling used when modifying the volatile keyword, which means they judge by this "shared conditional variables" whether changes to achieve communication between processes.

And a communication pipe, like message passing mechanism, that is to say: by pipes, a thread sends messages to the other.

 

 

    1.  Thread communication:

 

A shared variable, and the like as volatite

 

2wait / notify mechanism, preferably with genlock

 

3Lock / Condition mechanisms //condition.await (); condition.signalAll ();

 

4 pipeline // PipedOutputStream out; PipedInputStream in; out.connect (in); // can only be established once

---------------------

  1. ref

 (9+ messages) android innovative cross-process communication - emmmsuperdan's blog - CSDN blog .html

(9+ messages) multi-threaded, multi-process communication (java realization) - LittleMonkey's blog - CSDN blog .html

Communication between the (9+ messages) Java multi-threading and process - lovewebeye column - CSDN blog .html

(9+ messages) interview questions: IPC (inter-process communication) - songzi1228's blog - CSDN blog .html

 

 

 

 

About the Author

Ai Ai Tila Long attilax, Farmington st attilax akbar rinpoche 圣阿提拉科斯 Akbar Rinpoche

Tau Street Software Technology Organization founder Master uke

Academic achievement, perfect knowledge of the top 20, has a doctorate in Master uke College

Internet technology in the software industry background twelve years, csdn rankings TOP57

For many years engaged in software and Internet technology management, it is expected to share experiences published many books

Good at technology and management to standardize and cultural undertakings

Qq 1466519819 trumpet 112 237 553

 Small micro-channel attilax attilax201708

 

:: nickname and head of the street: old wow claws claw of messenger Eagle iconoclastic Iconoclast image-smasher God (Messenger of God) and Rye (Watch Man

Fowler king "Bird Catcher kok Pious Pious religious defenders Defender Of the Faith. Caracalla Caracalla red cloak KOA red cloak king of the beasts arson

 

Tau Street Source: The Messenger of God (Messenger of God) and Rye (Watch Man comes from the Bible

Old wow claws claw of Eagle from the Inca Empire

KOA king of the beasts from God Brahman large forest cultivation

 

 

 

Referred :: st Emir Attilax Akbar Akbar 圣埃米尔阿提 Laax

Full name :: st Emir Attilax Akbar bin Mahmud bin attila bin Solomon bin adam Al Rapanui 圣埃米尔阿提 Laax Mahmoud Akbar this this this Attila Adam Solomon this 阿尔拉帕努 Iraq

Common name: Ai Tila (Yilong), EMAIL: [email protected]

 

Like the nickname King of the fowler arsonists Laowa paws rabbit ears

Like the end of the street st St. Rinpoche guru Dr. Ma Sita artist's poet king

 

 

title:

 

UKE  Emir Uke tribal chief big chief, founder of the Association仁波切马斯塔Emir ati

uke headquarters o2o leader, founder of the Global Grid project,

圣阿提拉克斯 King

Science and technology Dean chairman of the Technical Committee for Standardization UTSC uke uke cto software chief director in charge of vice president, vice president of product uke Institute of Science and Technology Project Department Deputy Director, Director of Technology R & D uke software training guru

Institute research organization founder Ati

 

Literary field , director of the Association of locomotive ,, uke uke Tattoo Association

President of the Association of Friends uke uke hunting Association President

Arts Association president Ati ati Literary Society

 

Administrative areas Gchsp Standing GsP founder, president gchsp

Media communication field    uke Press editor editor publicity sermon Producer

Ati Media Headquarters

 

Fishing and hunting in the military field uke Security Department chief captain

Uke Outdoor Sports Association chief large resort village

Ati Hunting Association

Law Law Research System Research

Management areas of Business Administration and Public Administration Social Services

Vice President uke system Inspection Commission

The field of education  uec College President, uecip image processing machine vision professional uke Department document retrieval Head Professional

Uke image processing and machine vision School Principal Dean

Vice President uke lifelong education school

Liang Institute

 

The economy chain responsible for a large area uke Polynesian Kingdom of Tonga area regional head of uke chain responsible Kerguelen Islands area, responsible for the Line Islands chain area, uke Bouvet Island and South Georgia and the South Sandwich Islands chain responsible for a large area

 Vice president of software standardization Association chairman Uke Uke database and stored Standards Association

Direct bus head northwest direct bus Changsha and Xi'an branches Minister

Division Run-chang, president of messaging software division responsible for long-Executive Chairman of the Executive Committee

Ati Economic Research Institute

Historical areas Historical Institute of History Division ati

Social sciences Social Sciences, the Ministry of Culture ati

Natural sciences dean Uke Research Institute and principal investigator scientist

Ati Academy of Natural Sciences

Religious theology uke religious and cultural integration master master Affairs Minister

Chairman uke system and major meetings of the Committee ati religious office

Medicine    , founder of Uke's Hospital and Medical aspects

 

 

 

 

 

 

 

 

 

Reproduced please indicate the source: attilax column http://blog.csdn.net/attilax

http://www.cnblogs.com/attilax/

Microblog

http://weibo.com/u/5941179815   (common attilax)

https://weibo.com/p/1005055941179815 (attilax201707, bek weibo)

http://weibo.com/u/5487832265 (tech,for blog auto gene)

Space know almost

https://www.zhihu.com/people/ati-att/activities

Qq 1466519819 trumpet 112 237 553

 Small micro-channel attilax attilax201708

Microblogging attilax2016 trumpet attilax201707

 

 

--Atiend v23

Guess you like

Origin blog.csdn.net/attilax/article/details/93025003