Chap06(Interprocess Communication).PDF

Similar documents
고급 IPC 설비

<4D F736F F F696E74202D FBDC3BDBAC5DB56C0C720C7C1B7CEBCBCBDBAB0A320C5EBBDC5205BC8A3C8AF20B8F0B5E55D>

2009년 상반기 사업계획

Microsoft PowerPoint - UnixNetProg3rd_08_완.ppt [호환 모드]

메시지큐를이용한 IPC 프로그램구현과제보고서 1. 과제의목적 1 리눅스가지원하는프로세스간통신방식중다수의프로세스사이에구조화된데이터블럭, 즉메시지를전달하는데주로사용되는메시지큐방식에대하여무엇인지, 어떻게사용하는지공부한다. 2 공부한내용을점검하기위해기작성된 epda 프로세스관

6주차.key

운영체제 실습 - Introduction -

10주차.key

고급 IPC 설비

10.

슬라이드 1

Chap04(Signals and Sessions).PDF

슬라이드 1

강의10

untitled

Abstract View of System Components

Microsoft PowerPoint - ch09_파이프 [호환 모드]

2009년 상반기 사업계획

Microsoft PowerPoint - all_CDSP_2(2009).ppt [호환 모드]

PowerPoint 프레젠테이션

untitled

Embeddedsystem(8).PDF

T100MD+

chap7.key

chap 5: Trees

歯15-ROMPLD.PDF

SMB_ICMP_UDP(huichang).PDF

목차 1. 제품 소개 특징 개요 Function table 기능 소개 Copy Compare Copy & Compare Erase

Microsoft Word - ASG AT90CAN128 모듈.doc

untitled

°í¼®ÁÖ Ãâ·Â

1217 WebTrafMon II

hlogin7

CD-RW_Advanced.PDF

Microsoft PowerPoint - chap9 [호환 모드]

untitled

Deok9_Exploit Technique

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

chapter4

13.08 ②분석

Microsoft PowerPoint APUE(Intro).ppt

13주-14주proc.PDF

The Self-Managing Database : Automatic Health Monitoring and Alerting

휠세미나3 ver0.4

Something that can be seen, touched or otherwise sensed

MySQL-Ch10

PRO1_09E [읽기 전용]

Microsoft PowerPoint - IOControl [호환 모드]

SRC PLUS 제어기 MANUAL

Microsoft PowerPoint - o8.pptx

thesis

PowerPoint Presentation

원고스타일 정의


Polly_with_Serverless_HOL_hyouk


Chapter 4. LISTS

김기남_ATDC2016_160620_[키노트].key

2014밝고고운동요부르기-수정3

2005프로그램표지

¼º¿øÁø Ãâ·Â-1

Microsoft PowerPoint - 09-Pipe

Microsoft PowerPoint - StallingsOS6e-Chap06.ppt [호환 모드]

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

○ 제2조 정의에서 기간통신역무의 정의와 EU의 전자커뮤니케이션서비스 정의의 차이점은

untitled

hd1300_k_v1r2_Final_.PDF

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

Microsoft PowerPoint - polling.pptx

ecorp-프로젝트제안서작성실무(양식3)

TCP.IP.ppt

The_IDA_Pro_Book

vm-웨어-앞부속

Motor

목 차

PowerPoint 프레젠테이션

PCServerMgmt7

DBPIA-NURIMEDIA

untitled

PRO1_02E [읽기 전용]

Microsoft Word - KPMC-400,401 SW 사용 설명서

Microsoft Word - FS_ZigBee_Manual_V1.3.docx

Index Process Specification Data Dictionary

ABC 11장

MPLAB C18 C

디지털포렌식학회 논문양식

Abstract View of System Components

DocsPin_Korean.pages


Microsoft PowerPoint - 알고리즘_4주차_1차시.pptx

PowerPoint Presentation

ETL_project_best_practice1.ppt

Microsoft PowerPoint APUE(File InO).pptx

untitled

Microsoft Word - FunctionCall

hlogin2

목차 1. 개요 USB 드라이버 설치 (FTDI DRIVER) FTDI DRIVER 실행파일 USB 드라이버 확인방법 DEVICE-PROGRAMMER 설치 DEVICE-PROGRAMMER

X-VA-MT3809G-MT3810G-kor

Smart Power Scope Release Informations.pages

Transcription:

Interprocess Communication 2002 2 Hyun-Ju Park

Introduction (interprocess communication; IPC) IPC data transfer sharing data event notification resource sharing process control Interprocess Communication 1

Universal IPC facilities signal, pipe, process tracing IPC Interprocess Communication 2

Signals Limitation signals are expensive sender must make a system call limited bandwidth limited amount of information Interprocess Communication 3

Pipes (1) A unidirectional, FIFO, unstructured data stream of fixed maximum size Simple flow-control mechanism a process attempting to read from an empty pipe blocks until data is written to the pipe a process trying to write to a full pipe blocks until another process reads data from the pipe pipe() : read(), write() : Interprocess Communication 4

Pipes (2) Limitation data in a pipe is a byte-stream multiple reader, writer reader Implementation (in SVR2) inode BSD-based variants SVR4 Interprocess Communication 5

Pipes (3) FIFO file, named pipe mknod(filename, S_IFIFO) to create a FIFO file (persistent) pipes are easier to setup and consume fewer resources Interprocess Communication 6

SVR4 Pipes SVR4 STREAMS, FIFO SVR4 pipes are bidirectional status = pipe(int fildes[2]); STREAMS file descriptor status = fattach(int fildes, char *path); path :,, Interprocess Communication 7

Process Tracing (1) Use ptrace to control the execution of a child process dbx ptrace(cmd, pid, addr, data); pid : PID of the target process addr : location in the target s address space cmd : u area Interprocess Communication 8

Process Tracing (2) Limitation of ptrace if the traced process forks, the debugger cannot control the new process ptrace is extremely inefficient ptrace tracing a setuid program raises a security problem SVR4 and Solaris provide much more efficient debugging facilities using the /proc file system Interprocess Communication 9

Process Tracing (3) /proc file system /proc, /proc PID /proc, lseek, read, write ioctl /proc file system is not a physical file Interprocess Communication 10

System V IPC System V IPC - semaphores, message queues, and shared memory BSD UNIX Interprocess Communication 11

(1) IPC,, IPC (key) (creator) (owner) (permissions) UID & GID UID & GID,, / / IPC_STAT / IPC_SET : IPC_RMID : Interprocess Communication 12

(2) IPC ipc_perm Interprocess Communication 13

(1) semget semid = semget(key, count, flag) key : 32bit value count : an array of count semaphores flag : IPC_CREAT, IPC_EXCL Interprocess Communication 14

(2) semop status = semop(semid, sops, nsops); sops: a pointer to an nsops-element array of sembuf structures struct sembuf { unsigned short sem_num; short sem_op; short sem_flg; } semop > 0 : V() operation semop = 0 : 0 sem_op <0 : semop Interprocess Communication 15

(3) struct semid_ds { } struct ipc_perm sem_perm; struct sem* sem_base; // pointer to array of semaphores in set ushort struct sem { } ushort pid_t ushort ushort semval; sempid; semncnt; semzcnt; sem_nsems; // number of semaphores in set Interprocess Communication 16

(4) Major problems with semaphores race conditions & deadlock avoidance Interprocess Communication 17

(1) msgget / msgqid=msgget(key, flag); msgsnd msgsnd(msgqid, msgp, count, flag); msgrcv count = msgrcv(msgqid, msgp, maxcnt, msgtype, flag); Interprocess Communication 18

(2) message queue resource table entry struct msqid_ds { } struct ipc_perm msg_perm struct msg* struct msg* msg_first; msg_last; Interprocess Communication 19

(3) receivers P P msg Struct msgqid_ds msg msg senders P P Interprocess Communication 20

(4) message queue transmit data as discrete messages rather than as an unformatted byte-stream(pipe),, 2 do not supply a broadcast mechanism Interprocess Communication 21

(1) shmid=shmget(key,size,flag) addr = shmat(shmid,shmaddr,shmflag); shmdt(shmaddr); shared memory resource table entry struct shmid_ds { } struct ipc_perm shm_perm; int shm_segsz; Interprocess Communication 22

(2) 0x30000 0x50000 Memory map of process A 0 Shared memory region Memory map of process B 0 0x50000 0x70000 Interprocess Communication 23