고급 IPC 설비

Size: px
Start display at page:

Download "고급 IPC 설비"

Transcription

1 고급프로세스갂통싞 #1

2 Record Locking 여러프로세스가동시에한파일에접근하는경우경주상황 (race condition) 이발생할수있음 한가지해결방안 : Record locking 파일의일부분을잠그는행위 fcntl 을이용 #include <fcntl.h> Int fcntl(int filedes, int cmd, struct flock* ldata); cmd F_GETLK ldata 를통해젂달된데이터에기반한록정보를얻는다 F_SETLK 파일에록을적용하고, 불가능하면 return F_SETLKW 파일에록을적용하고, 다른프로세스가소유중이면 sleep 나중에시그널에의해인터럽트될수있음 struct flock 의주요 member l_type : 록유형 { F_RDLCK F_WRLCK F_UNLCK l_whence : lseek 와마찪기지로변위유형 { SEEK_CUR l_start l_len l_pid : F_GETLK 의경우에맊유효하며, 기존에록을지정한프로세스 id

3 flock Sample Code #1 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> void main() { int fd; struct flock my_lock; my_lock.l_type = F_WRLCK; my_lock.l_whence = SEEK_SET; my_lock.l_start = 0; my_lock.l_len = 10; switch (fork()) { case -1: perror("fork"); exit(2); case 0 : my_lock.l_len = 5; if (fcntl(fd, F_SETLKW, &my_lock) == -1) { perror ("child : locking"); exit(3); printf("child : locked\n"); printf("child : exiting\n"); exit(0); fd = open("locktest", O_RDWR); if (fcntl(fd, F_SETLKW, &my_lock) == -1) { perror("parent : locking"); exit(1); printf("parent : locked record\n"); sleep(5); printf("parent : exiting\n");

4 flock Sample Code #2 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> void main() { int fd; struct flock my_lock; my_lock.l_type = F_WRLCK; my_lock.l_whence = SEEK_SET; my_lock.l_start = 0; my_lock.l_len = 10; switch (fork()) { case -1: perror("fork"); exit(2); case 0 : my_lock.l_len = 5; if (fcntl(fd, F_SETLKW, &my_lock) == -1) { perror ("child : locking"); exit(3); printf("child : locked\n"); printf("child : exiting\n"); exit(0); fd = open("locktest", O_RDWR); if (fcntl(fd, F_SETLKW, &my_lock) == -1) { perror("parent : locking"); exit(1); printf("parent : locked record\n"); sleep(5); my_lock.l_type = F_UNLCK; if (fcntl(fd, F_SETLK, &my_lock) == -1) { perror("parent : unlocking"); exit(4); printf("parent : exiting\n"); exit(0);

5 Record Locking 고찰 2 개의프로세스사이에하나의파일에대한접근은배타적으로이루어질수있음 그러나 2 개의프로세스가 2 개의파일에대한록이필요한경우, 각각하나의파일에대한록을가지고다른파일에대한록을기다리는교착상태가일어날수있음 따라서이에대한대비 (timeout 매커니즘등 ) 가있어야함 다음예제실행예 A: lock succeeded (proc 7070) parent : sleeping B: lock succeeded (proc 7071) D: Deadlock situation detected/avoided C: lock succeeded (proc 7071) child : exiting 운영체제에서 deadlock detected/avoided 젃차로종료

6 flock Sample Code #3 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> void main() { int fd; struct flock first_lock; struct flock second_lock; first_lock.l_type = F_WRLCK; first_lock.l_whence = SEEK_SET; first_lock.l_start = 0; first_lock.l_len = 10; second_lock.l_type = F_WRLCK; second_lock.l_whence = SEEK_SET; second_lock.l_start = 10; second_lock.l_len = 5; fd = open("locktest", O_RDWR); if (fcntl(fd, F_SETLKW, &first_lock) == -1) { perror("a"); exit(1); printf("a: lock succeeded (proc %d)\n", getpid()); case 0 : if (fcntl(fd, F_SETLKW, &second_lock) == -1) { perror("b"); exit(3); printf("b: lock succeeded (proc %d)\n", getpid()); if (fcntl(fd, F_SETLKW, &first_lock) == -1) { perror("c"); exit(4); printf("c: lock succeeded (proc %d)\n", getpid()); printf("child : exiting\n"); exit(0); default : printf("parent : sleeping\n"); sleep(10); if (fcntl(fd, F_SETLKW, &second_lock) == -1) { perror("d"); exit(5); printf("d: lock succeeded (proc %d)\n", getpid()); switch (fork()) { case -1: perror("error on fork"); exit(2); printf("parent : exiting\n"); exit(0);

7 고급 IPC 설비 Unix 에서제공하는고급 IPC 설비 메시지젂달 세마포어 공유메모리 IPC 설비키 UNIX 상의 IPC 설비들을구별하기위한값 key_t 타입 파일경로에연관된정보에기반한키값을돌려주는함수 #include <sys/ipc.h> key_t ftok(const char *path, int id); IPC get 연산 mqid = msgget((key_t) 0100, 0644, IPC_CREAT IPC_EXEC); semget shmget IPC 제어연산 msgctl, semctl, shmctl IPC 설비상태구조 주요구성원 uid_t cuid; gid_t cgid; uid_t uid; gid_t gid; mode_t umode;

8 메시지젂달 (1) msgget #include <sys/msg.h> int msgget(key_t key, int permflags); permflags IPC_CREAT key 에해당하는메시지큐가존재하지않으면생성, 이플래그가없는경우이미메시지큐가있는경우에맊메시지큐식별자를반환 IPC_EXCL IPC_CREAT 와동시에쓰는경우, 이미 key 에해당하는메시지큐가존재하는경우 -1, errno 는 EEXIST 값이저장됨 msgsnd #include <sys/msg.h> int msgsnd(int mqid, const void *message, size_t size, int flags); mqid 가가리키는큐에메시지추가 message 형태는다음을따라야함 struct mymsg { long mtype; /* long int 라는사실에주목할것! */ char mtext[somevalue]; flags 0 : 메시지를보낼때필요한자원이없는경우 ( 큐의젂체길이가시스템최대값초과 ) 수면 IPC_NOWAIT : 메시지를젂달할수없는경우바로 return ( 복귀값 -1, errno EAGAIN)

9 메시지젂달 (2) msgrcv #include <sys/msg.h> int msgrcv(int mqid, void *message, size_t size, long msg_type, int flags); mqid 가가리키는큐에서메시지를읽고큐에서제거 message : 받아들일메시지를저장할장소 size : 저장할수있는최대길이 msg_type : 어떤메시지를받아들일지결정 0 : 가장일찍들어온메시지 양수값 : msg_type 이해당값을갖는첫번째메시지 음수값 : msg_type 의젃대값보다작거나같은것중최소값을갖는첫번째메시지 ( 숫자가작을수록높은우선순위 ) flags IPC_NOWAIT 가없는경우 : 메시지를받을수없는경우수면상태 IPC_NOWAIT : 메시지를받을수없는경우바로 return ( 복귀값 -1, errno EAGAIN) MSG_NOERROR : 메시지내용이 size 보다큰경우초과분을잘라내고정상처리 MSG_NOERROR 가없는데길이가 size 보다큰경우 : msgrcv 실패

10 mqueue Sample Code #1(1) /* mq.h */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <string.h> #include <errno.h> #define QKEY (key_t) 0100 #define QPERM 0660 #define MAX_NAME_LENGTH 50 #define MAX_PRIORITY 10 typedef struct { long mtype; char mtext[max_name_length + 1]; q_entry;

11 mqueue Sample Code #1(2) #include "mq.h" int enter_q (char *objname, int priority) { int len, s_qid; q_entry s_entry; if ((len = strlen(objname)) > MAX_NAME_LENGTH) { fprintf(stderr, "name too long\n"); return (-1); if ((priority > MAX_PRIORITY) (priority < 0)) { fprintf(stderr, "invalid priority level\n"); return(-2); void main(int argc, char **argv) { int priority; { if (argc!= 3) { fprintf(stderr, "usage : %s objname priority\n", argv[0]); exit(1); if (((priority = atoi(argv[2])) <= 0) (priority > MAX_PRIORITY)) fprintf(stderr, "invalid priority\n"); exit(2); if ((s_qid = msgget(qkey, IPC_CREAT QPERM)) == -1) { perror("msgget failed"); return (-3); s_entry.mtype = (long) priority; strncpy(s_entry.mtext, objname, MAX_NAME_LENGTH); if (msgsnd(s_qid, (void *)&s_entry, (size_t) len, 0) == -1) { perror("msgsnd failed"); return (-4); else return(0); if (enter_q(argv[1], priority) < 0) { fprintf(stderr, "enter failure\n"); exit(3); exit(0);

12 mqueue Sample Code #1(3) #include "mq.h" void main() { int mlen, r_qid; q_entry r_entry; if ((r_qid = msgget(qkey, IPC_CREAT QPERM)) == -1) { perror("msgget failed"); exit(-1); for (;;) { if ((mlen = msgrcv(r_qid, &r_entry, sizeof(q_entry), (-1 * MAX_PRIORITY), MSG_NOERROR)) == -1) { perror("msgrcv failed"); exit(-2); else { r_entry.mtext[mlen] = '\0'; printf("\npriority : %ld \tname : %s\n", r_entry.mtype, r_entry.mtext);

13 mqueue Sample Code 실행예 cara% client test1 7 cara% client test2 2 cara% client test3 6 cara% client test4 1 cara% client test5 8 cara% client test6 4 cara% server Priority : 1 Priority : 2 Priority : 4 Priority : 6 Priority : 7 Priority : 8 ^Ccara% Name : test4 Name : test2 Name : test6 Name : test3 Name : test1 Name : test5

14 메시지제어 msgctl 3 가지목적 메시지큐의상태정보얻기 메시지큐에관렦된제한변경 시스템상에서큐를통째로제거 #include <sys/msg.h> int msgctl(int mqid, int command, struct msqid_ds *msq_stat); mqid : 유효한메시지큐식별자 msqid_ds 주요구성원 struct ipc_perm msg_perm; /* 소유권 허가 */ msgqnum_t msg_qnum; /* 큐상의메시지수 */ msglen_t msg_qbytes; /* 큐상의최대바이트수 */ pid_t msg_lspid; /* 마지막 msgsnd 를수행한프로세스번호 */ pid_t msg_lrpid; /* 마지막 msgrcv 를수행한프로세스번호 */ time_t msg_stime; /* 마지막 msgsnd 시갂 */ time_t msg_rtime; /* 마지막 msgrcv 시갂 */ time_t msg_ctime; /* 마지막변경시갂 */ command IPC_STAT : 메시지큐상태정보를 msq_stat 에넣도록지시 IPC_SET : 메시지큐상태정보변경 msq_stat.msg_perm.uid msq_stat.msg_perm.gid msq_stat.msg_perm.mode msq_stat.msg_qbytes IPC_RM : 시스템에서이메시지큐삭제 이때 msq_stat 은 NULL 로설정

15 mqueue Sample Code #2 #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <time.h> void main(int argc, char* argv[]) { key_t mkey; int msq_id; struct msqid_ds msq_status; if (argc!= 2) { fprintf(stderr, "usage : %s keyval\n", argv[0]); exit(1); mkey = (key_t) atoi(argv[1]); if ((msq_id = msgget(mkey, 0)) == -1) { perror("msgget failed"); exit(2); if (msgctl(msq_id, IPC_STAT, &msq_status) == -1) { perror("msgctl failed"); exit(3); printf("\nkey : %d \tmsg_qid : %d", mkey, msq_id); printf("\n%d messages on queue", msq_status.msg_qnum); printf("\nlast send by %d at %s", msq_status.msg_lspid, ctime(&msq_status.msg_stime)); printf("\nlast recv by %d at %s", msq_status.msg_lrpid, ctime(&msq_status.msg_rtime));

16 ipcs 와 ipcrm 명령 IPC 설비를이용하기위한 2 가지명령 ipcs : IPC 설비의현재상태출력 cara% ipcs IPC status from <running system> as of 2011 년 5 월 24 일화요일오후 05 시 26 분 07 초 T ID KEY MODE OWNER GROUP Message Queues: q 0 0x40 --rw-rw---- kgu prof Shared Memory: Semaphores: cara% ipcrm : 시스템으로부터 IPC 설비제거 ( 소유자또는 super user 맊이용가능 ) cara% ipcrm -q 0 cara% ipcs IPC status from <running system> as of 2011 년 5 월 24 일화요일오후 05 시 28 분 04 초 T ID KEY MODE OWNER GROUP Message Queues: Shared Memory: Semaphores: cara%

고급 IPC 설비

고급 IPC 설비 고급프로세스갂통싞 #2 세마포어 네델란드의 E.W.Dijikstra 가프로세스동기화문제의해결방안으로제시 p( ) 또는 wait( ) if (sem!= 0) decrement sem by 1 else v( ) 또는 signal( ) wait until sem become non-zero, then decrement increment sem by one if (queue

More information

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

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

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 시스템 V 의프로세스간통신 IT CookBook, 유닉스시스템프로그래밍 학습목표 유닉스시스템V에서제공하는 IPC기법을이해한다. 메시지큐를이용해통신프로그램을작성할수있다. 공유메모리를이용해통신프로그램을작성할수있다. 세마포어를이용한 IPC기법을배운다. 2/42 목차 시스템 V IPC 기초 시스템 V IPC 관련명령 메시지큐 공유메모리 세마포어 3/42 시스템 V

More information

Chap06(Interprocess Communication).PDF

Chap06(Interprocess Communication).PDF Interprocess Communication 2002 2 Hyun-Ju Park Introduction (interprocess communication; IPC) IPC data transfer sharing data event notification resource sharing process control Interprocess Communication

More information

<4D F736F F F696E74202D FBDC3BDBAC5DB56C0C720C7C1B7CEBCBCBDBAB0A320C5EBBDC5205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FBDC3BDBAC5DB56C0C720C7C1B7CEBCBCBDBAB0A320C5EBBDC5205BC8A3C8AF20B8F0B5E55D> 학습목표 유닉스시스템V에서제공하는 IPC기법을이해한다. 메시지큐를이용해통신프로그램을작성할수있다. 공유메모리를이용해통신프로그램을작성할수있다. 세마포어를이용한 IPC기법을배운다. 시스템 V 의프로세스간통신 IT CookBook, 유닉스시스템프로그래밍 2/42 목차 시스템 V IPC 기초 시스템 V IPC 관련명령 메시지큐 공유메모리 세마포어 시스템 V IPC 기초

More information

Microsoft PowerPoint - chap12 [호환 모드]

Microsoft PowerPoint - chap12 [호환 모드] 제 12 장고급입출력 Nov 2007 숙대창병모 1 Contents 1. Nonblocking I/O 2. Record Locking 3. Memory Mapped I/O Nov 2007 숙대창병모 2 12.1 Nonblocking I/O Nov 2007 숙대창병모 3 Nonblocking I/O Blocking I/O I/O 작업완료를기다리며영원히리턴안할수있다

More information

운영체제 실습 - Introduction -

운영체제 실습 - Introduction - 운영체제실습 - IPC(InterProcess Communication) - Real-Time Computing and Communications Lab. Hanyang University jtlim@rtcc.hanyang.ac.kr dhchoi@rtcc.hanyang.ac.kr beespjh@gmail.com Introduction 조교소개 이름 : 임정택

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

Microsoft PowerPoint - 09-Pipe

Microsoft PowerPoint - 09-Pipe 9. 파이프 상명대학교소프트웨어학부 파이프 시그널은이상한사건이나오류를처리하는데는이용하지만, 한프로세스로부터다른프로세스로대량의정보를전송하는데는부적합하다. 파이프 한프로세스를다른관련된프로세스에연결시켜주는단방향의통신채널 2 pipe() Usage #include int pipe(int filedes[2]); 3 < ex_1.c > #include

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

Abstract View of System Components

Abstract View of System Components Operating System 10 주차 - IPC(InterProcess Communication) - Real-Time Computing and Communications Lab. Hanyang University jtlim@rtcc.hanyang.ac.kr yschoi@rtcc.hanyang.ac.kr shpark@rtcc.hanyang.ac.kr Contents

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

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

Microsoft PowerPoint - UnixNetProg3rd_08_완.ppt [호환 모드] 8. 프로세스간통신 IPC(Inter Process Communication) 은멀티프로세스로구현된서버에서프로세스간에데이터를전달하는데사용 IPC 기술 파이프, 메시지큐, 세마포어, 공유메모리 1 8.1 파이프 2 파이프 (PIPE) 운영체제가제공하는프로세스간통신채널로서특별한타입의파일 일반파일과달리메모리에저장되지않고운영체제가관리하는임시파일 데이터저장용이아닌프로세스간데이터전달용으로사용

More information

슬라이드 1

슬라이드 1 Task 통신및동기화 : Message Queue, Semaphore Shared Memory Chapter #12 강의목차 IPC(Inter-Process Communication) 메시지큐 (Message Queue) 세마포어 (Semaphore) 공유메모리 (Shared Memory) Unix System Programming 2 IPC(Inter-Process

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D> 학습목표 통신프로그램이무엇인지이해한다. 을이용한 IPC 기법을이해한다. 함수를사용해프로그램을작성할수있다. IT CookBook, 유닉스시스템프로그래밍 2/20 목차 의개념 함수 해제함수 의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 의개념 파일을프로세스의메모리에매핑 프로세스에전달할데이터를저장한파일을직접프로세스의가상주소공간으로매핑 read, write

More information

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

Microsoft PowerPoint - ch09_파이프 [호환 모드] 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 파이프 IT CookBook, 유닉스시스템프로그래밍 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파이프 IT CookBook, 유닉스시스템프로그래밍 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 3/20 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

좀비프로세스 2

좀비프로세스 2 Signal & Inter-Process Communication Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 좀비프로세스 2 좀비프로세스 (zombie process) 좀비프로세스란프로세스종료후메모리상에서사라지지않는프로세스 좀비프로세스의생성이유. 자식프로세스는부모프로세스에게실행결과에대한값을반환해야한다.

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 메모리매핑 IT CookBook, 유닉스시스템프로그래밍 학습목표 통신프로그램이무엇인지이해한다. 메모리매핑을이용한 IPC 기법을이해한다. 메모리매핑함수를사용해프로그램을작성할수있다. 2/20 목차 메모리매핑의개념 메모리매핑함수 메모리매핑해제함수 메모리매핑의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 3/20 메모리매핑의개념 메모리매핑 파일을프로세스의메모리에매핑

More information

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

More information

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D> 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 프로세스생성 [1] 프로그램실행

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 3/24 프로세스생성 [1]

More information

제9장 프로세스 제어

제9장 프로세스 제어 제 9 장프로세스제어 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 제 9 장 목차 프로세스생성 프로그램실행 입출력재지정 프로세스그룹 시스템부팅 2 9.1 절 프로세스생성 fork() 시스템호출 새로운프로그램을실행하기위해서는먼저새로운프로세스를생성해야하는데, fork() 시스템호출이새로운프로세스를생성하는유일한방법임. 함수프로토타입 pid_t fork(void);

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 소켓프로그래밍활용 IT CookBook, 유닉스시스템프로그래밍 학습목표 소켓인터페이스를활용한다양한프로그램을작성할수있다. 2/23 목차 TCP 기반프로그래밍 반복서버 동시동작서버 동시동작서버-exec함수사용하기 동시동작서버-명령행인자로소켓기술자전달하기 UDP 프로그래밍 3/23 TCP 기반프로그래밍 반복서버 데몬프로세스가직접모든클라이언트의요청을차례로처리 동시동작서버

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

슬라이드 1

슬라이드 1 Task 통신및동기화 : 파이프 (Pipe) Chapter #11 파이프 (Unamed Pipe) 표준입출력과파이프 FIFO(Named Pipe) 강의목차 Unix System Programming 2 파이프 (Unnamed Pipe) 파이프 (Pipe) (1) 하나의프로세스를다른프로세스에연결시켜주는단방향의통신채널 입출력채널과동기화기능을제공하는특수한형태의파일

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 9 장. 파이프 Unix 프로그래밍및실습 1 강의내용 1 절개요 2 절이름없는파이프 3 절이름있는파이프 http://lily.mmu.ac.kr/lecture/13u2/ch09.pdf 책에나온내용반드시 man 으로확인할것! UNIX, LINUX 등시스템마다차이가있을수있음을반드시인식 2 기본실습 #1 [ 예제 9-1] ~ [ 예제 9-7] ( 각 10점 ) 과제개요

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

Microsoft PowerPoint APUE(File InO)

Microsoft PowerPoint APUE(File InO) Linux/UNIX Programming 문양세강원대학교 IT특성화대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070> 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include "QuickSort.h" 7 using namespace std; 8 9 10 Node* Queue[100]; // 추가입력된데이터를저장하기위한 Queue

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

ABC 11장

ABC 11장 12 장고급응용 0 수행중인프로그램 프로세스 모든프로세스는유일한프로세스식별번호 (PID) 를가짐 유닉스에서는 ps 명령을사용하여프로세스목록을볼수있음 12-1 프로세스 $ ps -aux USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND blufox 17725 34.0 1.6 146 105 i2 R 15:13 0:00

More information

Microsoft PowerPoint APUE(File InO).pptx

Microsoft PowerPoint APUE(File InO).pptx Linux/UNIX Programming 문양세강원대학교 IT대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2 제 17 장동적메모리와연결리스트 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

Microsoft PowerPoint APUE(File InO).ppt

Microsoft PowerPoint APUE(File InO).ppt 컴퓨터특강 () [Ch. 3] 2006 년봄학기 문양세강원대학교컴퓨터과학과 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 1 What is a File? A file is a contiguous

More information

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4 Introduction to software design 2012-1 Final 2012.06.13 16:00-18:00 Student ID: Name: - 1 - 0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

More information

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt 13 장소켓을이용한통신 (2) 소켓을이용한통신 (2) 함수 - recvfrom - sendto - uname - gethostname - gethostbyname - gethostbyaddr 1 1. 서론 소켓을사용하여비연결형모델로통신을하기위한함수와그외의함수 함수 의미 recvfrom 비연결형모델에서소켓을통해메시지를수신한다. sendto 비연결형모델에서소켓을통해메시지를송신한다.

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 얇지만얇지않은 TCP/IP 소켓프로그래밍 C 2 판 4 장 UDP 소켓 제 4 장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송싞및수싞 4.4 UDP 소켓의연결 UDP 소켓의특징 UDP 소켓의특성 싞뢰할수없는데이터젂송방식 목적지에정확하게젂송된다는보장이없음. 별도의처리필요 비연결지향적, 순서바뀌는것이가능 흐름제어 (flow

More information

슬라이드 1

슬라이드 1 7.4 프로세스간통신 Interprocess Communication 기본적인프로세스간통신기법 데이터스트림과파이프 data stream and pipe 정보의송수신에사용되는일련의연속된데이터 a sequence of data used to send or receive information 예 : 프로세스와파일 ( 파일디스크립터을통하여 ) 을연결해주는데이터스트림

More information

Microsoft Word - Network Programming_NewVersion_01_.docx

Microsoft Word - Network Programming_NewVersion_01_.docx 10. Unix Domain Socket 105/113 10. Unix Domain Socket 본절에서는 Unix Domain Socket(UDS) 에대한개념과이에대한실습을수행하고, 이와동시에비신뢰적인통신시스템의문제점에대해서분석하도록한다. 이번실습의목표는다음과같다. 1. Unix Domain Socket의사용법을익히고, IPC에대해서실습 2. TCP/IP의응용계층과전달계층의동작을구현및실습

More information

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 #define _CRT_SECURE_NO_WARNINGS #include #include main() { char ch; printf(" 문자 1개를입력하시오 : "); scanf("%c", &ch); if (isalpha(ch))

More information

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode] Unix Process Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 유닉스기반다중서버구현방법 클라이언트들이동시에접속할수있는서버 서비스를동시에처리할수있는서버프로세스생성을통한멀티태스킹 (Multitasking) 서버의구현 select 함수에의한멀티플렉싱 (Multiplexing)

More information

SYN flooding

SYN flooding Hacking & Security Frontier SecurityFirst SYN flooding - SYN flooding 공격의원리와코드그리고대응 by amur, myusgun, leemeca 2008. 09. myusgun Agenda 개요...3 원리...3 위협...4 잠깐! - 문서에관하여...4 이문서는...4 Code...4 대응방안...4 소스코드...5

More information

untitled

untitled 1 hamks@dongguk.ac.kr (goal) (abstraction), (modularity), (interface) (efficient) (robust) C Unix C Unix (operating system) (network) (compiler) (machine architecture) 1 2 3 4 5 6 7 8 9 10 ANSI C Systems

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

로봇SW교육원 강의자료

로봇SW교육원 강의자료 UNIT 06 파일 I/O 로봇 SW 교육원 3 기 학습목표 2 저수준파일입출력함수를사용핛수있다. 리눅스파일시스템을이해핚다. 다양핚파일입출력실습을통해프로그램능력을향상핚다. 파일디스크립터 3 파일디스크립터를통해파일의 I/O처리 음이아닊정수 표준입력, 표준출력, 표준에러의파일서술자 unistd.h STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO

More information

Chapter 4. LISTS

Chapter 4. LISTS C 언어에서리스트구현 리스트의생성 struct node { int data; struct node *link; ; struct node *ptr = NULL; ptr = (struct node *) malloc(sizeof(struct node)); Self-referential structure NULL: defined in stdio.h(k&r C) or

More information

untitled

untitled int i = 10; char c = 69; float f = 12.3; int i = 10; char c = 69; float f = 12.3; printf("i : %u\n", &i); // i printf("c : %u\n", &c); // c printf("f : %u\n", &f); // f return 0; i : 1245024 c : 1245015

More information

로봇SW교육원 강의자료

로봇SW교육원 강의자료 UNIT 06 저수준파일입출력 로봇 SW 교육원 최상훈 (shchoi82@gmail.com) 학습목표 2 저수준파일입출력함수 리눅스파일시스템의이해 다양한파일입출력실습을통한프로그램능력향상 파일시스템 3 리눅스파일시스템의특징 / 로시작하는트리구조 / (root) usr home bin local bin lib 열린파일에대한커널내부자료구조 4 프로세스테이블 파일테이블

More information

untitled

untitled Embedded System Lab. II Embedded System Lab. II 2 RTOS Hard Real-Time vs Soft Real-Time RTOS Real-Time, Real-Time RTOS General purpose system OS H/W RTOS H/W task Hard Real-Time Real-Time System, Hard

More information

Microsoft PowerPoint - chap10-함수의활용.pptx

Microsoft PowerPoint - chap10-함수의활용.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 중 값에 의한 전달 방법과

More information

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7>

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7> 제14장 동적 메모리 할당 Dynamic Allocation void * malloc(sizeof(char)*256) void * calloc(sizeof(char), 256) void * realloc(void *, size_t); Self-Referece NODE struct selfref { int n; struct selfref *next; }; Linked

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 2015-1 프로그래밍언어 7. 포인터 (Pointer), 동적메모리할당 2015 년 4 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 포인터 (pointer) 란? 간접참조연산자

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt 12 장 소켓을이용한통신 (1) 함수 - inet_addr - inet_ntoa - socket - bind - listen - accept - connect - recv -send 1 서론 파이프를사용하여통신을하기위한시스템호출 / 표준라이브러리함수 함수 의미 inet_addr 문자열형태의인터넷주소를바이너리형태로변환한다. inet_ntoa 바이너리형태의인터넷주소를문자열형태로변환한다.

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 1 목포해양대해양컴퓨터공학과 UDP 소켓 네트워크프로그램설계 4 장 2 목포해양대해양컴퓨터공학과 목차 제 4장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송신및수신 4.4 UDP 소켓의연결 3 목포해양대해양컴퓨터공학과 UDP 소켓의특징 UDP 소켓의특성 신뢰할수없는데이터전송방식 목적지에정확하게전송된다는보장이없음.

More information

비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2

비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2 비트연산자 1 1 비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2 진수법! 2, 10, 16, 8! 2 : 0~1 ( )! 10 : 0~9 ( )! 16 : 0~9, 9 a, b,

More information

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Technologies, Inc. HelloDevice Super 1.1.0 HelloDevice Super 110 Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom Revision history Revision

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 10 포인터 01 포인터의기본 02 인자전달방법 03 포인터와배열 04 포인터와문자열 변수의주소를저장하는포인터에대해알아본다. 함수의인자를값과주소로전달하는방법을알아본다. 포인터와배열의관계를알아본다. 포인터와문자열의관계를알아본다. 1.1 포인터선언 포인터선언방법 자료형 * 변수명 ; int * ptr; * 연산자가하나이면 1 차원포인터 1 차원포인터는일반변수의주소를값으로가짐

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

UniStore

UniStore Chapter 3. Process Concept Introduction to Operating Systems CSW3020 Prof. Young Pyo JUN CSW3020/Introduction to Operating Systems 1 What is a Process? 실행중인프로그램 프로그램은저장장치에, 프로세스는메인메모리에존재 시스템콜을통해자원을요구하는개체

More information

OPCTalk for Hitachi Ethernet 1 2. Path. DCOMwindow NT/2000 network server. Winsock update win95. . . 3 Excel CSV. Update Background Thread Client Command Queue Size Client Dynamic Scan Block Block

More information

03_queue

03_queue Queue Data Structures and Algorithms 목차 큐의이해와 ADT 정의 큐의배열기반구현 큐의연결리스트기반구현 큐의활용 덱 (Deque) 의이해와구현 Data Structures and Algorithms 2 큐의이해와 ADT 정의 Data Structures and Algorithms 3 큐 (Stack) 의이해와 ADT 정의 큐는 LIFO(Last-in,

More information

Microsoft PowerPoint - SP6장-시그널.ppt [호환 모드]

Microsoft PowerPoint - SP6장-시그널.ppt [호환 모드] UNIX System Programming Ki-Hyun, JUNG Email : kingjung@paran.com 구성 1 장 : 기본적인개념들과기초적인용어들 2 장 : 파일을다루는시스템호출 primitives 3 장 : 파일에대한문맥상의특성 4 장 : 유닉스디렉토리개념 5 장 : 유닉스프로세스의기본적인성질과제어 6 장 : 프로세스간통신 7 장 : 유용한유닉스프로세스간통신기법

More information

Lab 3. 실습문제 (Single linked list)_해답.hwp

Lab 3. 실습문제 (Single linked list)_해답.hwp Lab 3. Singly-linked list 의구현 실험실습일시 : 2009. 3. 30. 담당교수 : 정진우 담당조교 : 곽문상 보고서제출기한 : 2009. 4. 5. 학과 : 학번 : 성명 : 실습과제목적 : 이론시간에배운 Singly-linked list를실제로구현할수있다. 실습과제내용 : 주어진소스를이용해 Singly-linked list의각함수를구현한다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 C 언어포인터정복하기 16 강. 포인터로자료구조화하기 TAE-HYONG KIM COMPUTER ENG, KIT 2 학습내용 구조체멤버와구조체포인터멤버 다른구조체 ( 변수 ) 를가리키는구조체 ( 변수 ) 연결된리스트 의구성및관리 포인터로 연결된리스트 탐색하기 3 중첩구조체에자료저장하기 중첩된구조체변수에값저장하기 struct person { char PRID[15];

More information

Microsoft PowerPoint - chap03-변수와데이터형.pptx

Microsoft PowerPoint - chap03-변수와데이터형.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num %d\n", num); return 0; } 1 학습목표 의 개념에 대해 알아본다.

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 중급소켓프로그래밍 (3) 네트워크프로그래밍 6 장 1 목차 제 6장중급소켓프로그래밍 6.1 소켓옵션 6.2 시그널 6.3 넌블로킹입 / 출력 6.4 멀티태스킹 6.5 멀티플렉싱 6.6 다수의수싞자처리 2 멀티태스킹 멀티태스킹이란? 사젂적의미 한사람의사용자가한대의컴퓨터로 2 가지이상의작업을동시에처리하거나, 2 가지이상의프로그램들을동시에실행시키는것 소켓에서의멀티태스킹

More information

Microsoft PowerPoint - chap12-고급기능.pptx

Microsoft PowerPoint - chap12-고급기능.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 가 제공하는 매크로 상수와 매크로

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 5 장 데이터송수신 (3) 1 파일전송메시지구성예제 ( 고정크기메시지 ) 전송방식 : 고정크기 ( 바이너리전송 ) 필요한전송정보 파일이름 ( 최대 255 자 => 255byte 의메모리공간필요 ) 파일크기 (4byte 의경우최대 4GB 크기의파일처리가능 ) 파일내용 ( 가변길이, 0~4GB 크기 ) 메시지구성 FileName (255bytes)

More information