고급동기화및프로세스간통신

Size: px
Start display at page:

Download "고급동기화및프로세스간통신"

Transcription

1 고급동기화및프로세스간통신

2 Event Mechanism Supported by OS Events Event 란? 일단의프로세스들에게어떤조건의발생을알리는데이용이조건 ( 사건 ) 은 OS 마다여러변형이있음 Event 는세마포어와유사 Event 기다림 P 동작 Event 발생을알림 V 동작 Event descriptor (OS 관리데이터구조 ) Blocked processes list corresponding event Event 의처리방법하나의프로세스는다른프로세스가시그널을보낼때까지대기할수있음 (1) 시그널이발생할때 (2), 대기중인하나의프로세스는 unblock 됨 (3) queue function 이시그널을기다리는프로세스의개수를 return 함시그널을기다리지않는프로세스는그시그널을무시함세마포어와의차이점 - 세마포어는변수를갖는모든프로세스에영향 - Event 기반은 blocked 프로세스에영향 2

3 Flow of Events Events 의 skeleton Events (Cont d) 선 언 class Event { shared Event 변수이름 ; public: // 함수이름 } 실 행 변수이름. 함수이름 (); 3

4 Flow of Events Events (Cont d) Events 예제 class Event { shared Event topofhour; public: void signal(); void wait() int queue(); } 1 wait() topofhour 3 Resume 2 signal() Process i 정각이될때 (Event) 까지대기 // Wait until the top of the hour before proceeding topofhour.wait(); // It s the top of the hour... Process j 정각이되면 Event를대기하는프로세스가 없을때까지 Event를발생한다. while(true) if(istopofhour()) while(topofhour.queue() > 0) 4 topofhour.signal(); } 4

5 UNIX Signals Signal 은일종의 event 임 interrupt 와유사 특징 UNIX OS 가발생시키는소프트웨어적인 condition Interrupt handler (interrupt service routine) 과유사한 signal handler 가주어지거나 (IDT), 사용자가작성가능 UNIX 시그널의예 (Interrupt Descriptor Table) 사용자의 Control + C 입력 0 으로숫자를나누려는연산 존재하지않는파이프에입력하려는시도 etc. Table 사용이유 Desciptor 를장비에서제공하기때문에위치를알수없어직접 Access 가불가능그러므로 Table 에저장된주소값으로호출 Signal Mechanism Supported by OS 5

6 Characteristic of Signal UNIX Signals (cont d) UNIX는버전에따라고정된개수의 Signal 집합을가짐 signal.h 에 OS가사용할수있는 Signal이정의됨사용자정의시그널정의 SIGUSR1 & SIGUSR2 사용 kill(pid, signal); 시스템호출을이용하여시그널발생 pid : Signal을전송하려는프로세스 ID signal : 전송하려는정의된 Signal 혹은사용자정의 Signal send 기능과유사 6

7 UNIX Signals (cont d) 시그널처리의세가지방법 Kernel 의 default handler 가 Signal 처리 signal(sig#, SIG_DFL) 프로그래머가정의한 handler 가 Signal 처리 signal(sig#, myhandler) Signal 무시 signal(sig#, SIG_IGN) 7

8 Process Flow of Signal and Handler Signal Handling UNIX Signals (cont d) /* code for process p */ signal(sig#, sig_hndlr); /* ARBITRARY CODE */ void sig_hndlr(...) { /* ARBITRARY CODE */ } 시그널 SIG# 발생 실행중인프로세스, p p 는 block 시그널 handler (user defined) sig_hndlr 를 p 의 address space 에서실행 프로세스 p 실행재개 8

9 Example Code of Signal - 1 #include <signal.h> static void sig_handler(int); int main () { int parent_pid, child_pid, status; UNIX Signals (cont d) if(signal(sigusr1, sig_handler) == SIG_ERR) printf( Parent: Unable to create handler for SIGUSR1\n ); if(signal(sigusr2, sig_handler) == SIG_ERR) printf( Parent: Unable to create handler for SIGUSR2\n ); parent_pid = getpid(); if((child_pid = fork()) == 0) { child_pid = getpid(); printf( Child pid: %d\n, child_pid); kill(parent_pid, SIGUSR1); 1 for (;;) pause(); 2 } else { printf( Parent pid: %d\n, parent_pid); kill(child_pid, SIGUSR2); pause(); 1 printf( Parent: Terminating child \n ); kill(child_pid, SIGTERM); 2 wait(&status); printf( done\n ); } } 3 자식프로세스루틴 1 부모프로세스에게 SIGUSR1 시그널을보냄 2 부모가시그널이발생할때까지무한대기 부모프로세스루틴 1 자식프로세스에게 SIGUSR2 시그널을보냄 2 자식에게종료시그널 (SIGTERM) 을보냄 3 자식이종료될때까지대기함 9

10 static void sig_handler(int signo) { switch(signo) { int cur_pid = getpid(); Unix Signal (cont d) Example Code of Signal - 2 case SIGUSR1: /* Incoming SIGUSR1 */ printf( Parent: Received SIGUSER1 (pid: %d)\n, cur_pid); break; case SIGUSR2: /* Incoming SIGUSR2 */ printf( Child: Received SIGUSER2\n (pid: %d)\n, cur_pid); break; 시그널 handler default: break; } return; } 수행결과화면 10

11 Definition of Monitors Monitor 란? Monitors Language 에서동기화를제공하는추상화데이터타입 (ADT) 개념적으로동기적인접근이필요한데이터와데이터에접근하는 Critical Section 을포함한함수로구성. 공용인터페이스 아래와같은공용함수들을제공 monitor anadt { semaphore mutex = 1; // Implicit 일반함수 public: proc_i( ) { P(mutex); // Implicit <processing for proc_i>; V(mutex); // Implicit }; proce_j(..) { } } 공용함수 공용함수 J 지역변수 직접적데이터접근불가함수만이용가능 프로세스 / 스레드가사용할공유변수를 Monitor 내지역변수로선언 P, V 부분때문에함수는하나만실행가능 Implicit 부분컴파일러가제공 11

12 Monitors (Cont d) 모니터동작특징 : 지역변수는모니터내의함수 ( 프로시저 ) 에의해서만접근가능 Class 생각하면되겠네 프로세스는모니터의프로시저호출을통해모니터에진입가능언제나단지하나의프로세스만이모니터내부에존재 ( 상호배제 ) 상호배제 (Mutual exclusion) 를보장 상호배제를위하여별도의프로그램을작성할필요없음 운영체제에서제공 공유데이터또는자원을모니터안에둠으로써보호 공유자원을 Monitor 내부에지역변수로정의 12

13 Concept of Monitors Monitors (Cont d) Process Waiting Queue shared data operations High-Level Language Support Monitor 자원사용은상위언어에서만지원가능 Queue 에대기하고있는 Process 만이모니터객체의 data, operation 에차례대로접근가능 공유자원의동시접근을완전히해결 initialization code Instance of Monitor Class 13

14 Monitor Solution of Shared Value Monitor 예제 Monitors (Cont d) balance 변수를조작하는함수는 monitor 내에있으므로하나의프로세스만이 balance 변수조작가능. monitor sharedbalance { double balance; public: credit(double amount) {balance += amount;}; debit(double amount) {balance -= amount;}; 공용함수 공용함수 }; 14

15 Monitor Solution of Readers-Writers Case 1 Monitors (Cont d) Monitor 의선언과수행 (Reader/Writer 에 Monitor 적용예제 ) 보통의객체지향언어의사용과동일한형태. 협력하는프로세스의기본조건을만족. Monitor 선언코드 monitor readerwriter_1 { int numberofreaders = 0; int numberofwriters = 0; boolean busy = FALSE; - writer가사용중인지체크 public: startread() { }; finishread() { }; startwrite() { }; finishwrite() { }; }; Monitor 실행코드 reader(){ while(true) { startread(); read the resource; finishread(); } fork(reader, 0); fork(reader, 0): fork(writer, 0); fork(writer, 0); writer(){ while(true) { startwriter(); write the resource; finishwriter(); } 15

16 Monitor Problem of Readers-Writers Monitors (Cont d) 모니터에서발생가능한문제점 시나리오 1. Reader가대기큐에도착 2. Writer가대기큐에도착문제점 : finishread() 를수행하지못함 writer 가 startwriter 에서 busy waiting 을하고있기때문에 monitor 함수 finishread 수행이불가능 monitor readerwriter_1 { int numberofreaders = 0; int numberofwriters = 0; boolean busy = FALSE; public: startread() { while(numberofwriters!= 0) ; numberofreaders++; }; finishread() { numberofreaders--; }; startwrite() { numberofwriters++; while( busy (numberofreaders > 0) ) ; busy = TRUE; }; finishwrite() { numberofwriters--; busy = FALSE; }; }; 한번에하나의 process/threads 만동작가능하므로 while(); 이반복수행되면, 다른 Process / Thread 의진행이불가능함. 16

17 Problem of Monitor Monitors (Cont d) 모니터에서빠져나오기위해잠시멈추는 (Suspend) 방법이필요 프로세스 / 스레드는 condition 이바뀔때까지대기 Condition Variable condition 이바뀔때재시작할수있는특별한메커니즘필요 프로세스는 condition 이만족하지않을때, Monitor 를빠져나가 suspend 됨 다른프로세스가 condition 을변경할때 Suspend 된프로세스가깨어나고 Monitor 에진입 17

18 Solution of Monitor Problem Monitors (Cont d) Condition Variables 을이용하여해결. busy waiting 대체 일종의 OS 제공 event 임 모니터내부에서만발생 (event 는모든프로세스 / 스레드에영향 ) Condition Variable 을다루는 Operations wait: Suspend 다른프로세스가 signal 을수행하기전까지일시적으로중지된프로세스 signal: 하나라도일시중지된프로세스가있으면이를재개하도록한다. 없으면아무것도하지않음. queue: 적어도하나의일시중지된프로세스가존재하면 TRUE 를반환. 18

19 Monitor Solution of Readers-Writers Case 2 Reader/Writer 예제 Monitors (Cont d) monitor readerwriter_2 { int numberofreaders = 0; boolean busy = FALSE; condition oktoread, oktowrite; signal public: startread() { if(busy (oktowrite.queue()) oktoread.wait(); numberofreaders++; oktoread.signal(); }; finishread() { numberofreaders--; if(numberofreaders == 0) oktowrite.signal(); }; signal startwrite() { if((numberofreaders!= 0) busy) oktowrite.wait(); busy = TRUE; }; StartRead 는대기하고있는모든 Reader 에게시그널전송 (Reader 는동시에여러개수행가능 ) FinishRead 는모든 Reader 가작업종료시, Writer 에게시그널전송 signal finishwrite() { busy = FALSE; if(oktoread.queue()) oktoread.signal(); else oktowrite.signal(); }; }; signal FinishWrite 는대기하고있는 Reader 와 Writer 에게시그널전송 (Reader 에게우선순위부여 ) 19

20 Hoare semantics suspend(p 1 ) Signal Semantics if(resourcenotavailable()) resourcecondition.wait(); /* now available continue */ signal(p 0 ): Signal 이발생하면 P 0 는멈추고 P 1 이 if 문다음부터실행 resourcecondition.signal(); Hansen semantics(mesa 언어에서구현 ) suspend(p 1 ) while(resourcenotavailable()) resourcecondition.wait(); /* now available continue */ signal(p 0 ): P 0 는 Signal 을발생만시키고, 실행을계속하고끝낸후에 P 1 의조건을다시검사 resourcecondition.signal(); 적극적모니터방식 Signal 발생시 context switching 발생 Two Types of Monitor Semantics 수동적모니터방식 Signal 발생하더라도계속수행 20

21 Monitors 의예 문제정의한방향 (One way) 터널이존재반대편에차량이없는경우에만터널사용가능현재진행중인방향에도착하면터널을바로사용가능 North N Monitor Example of Traffic Problem 터널을지나갈수없음 N N S S 차량 : Process Condition Queue: 1 개 One-way tunnel S S 터널을지나갈수있음 South X S 터널을지나갈수있음 터널을지나갈수없음 21

22 Monitors 의예 (Cont d) 편도터널해결방법 차량이도착하면반대방향차량이있는가로진행여부판단 현재이동가능한방향은모든차량이지날때까지계속유지됨. 편도터널선언코드 monitor tunnel { int northbound = 0; int southbound = 0; trafficsignal nbsignal = RED; trafficsignal sbsignal = GREEN; condition busy; public: northboundarrival() { }; southboundarrival() { }; depart(direction exit) { }; 편도터널실행코드 NorthCar(){ while(true) { northboundarrival(); depart(north); } fork(northcar, 0); fork(southcar, 0): fork(northcar, 0); fork(southcar, 0); SouthCar(){ while(true) { southboundarrival(); depart(south); } }; 22

23 Monitors 의예 (Cont d) 편도터널의해결방법 Monitor Solution of Traffic Problem monitor tunnel { int northbound = 0, southbound = 0; trafficsignal nbsignal = RED, sbsignal = GREEN; condition busy; public: northboundarrival() { 1 if(southbound > 0) busy.wait(); northbound++; nbsignal = GREEN; sbsignal = RED; }; southboundarrival() { 2 if(northbound > 0) busy.wait(); southbound++; nbsignal = RED; sbsignal = GREEN; }; depart(direction exit) { 3 if(exit = NORTH) { northbound--; if(northbound == 0) while(busy.queue()) busy.signal(); }; } 4 Signal Signal else if(exit == SOUTH) { southbound--; if(southbound == 0) while(busy.queue()) busy.signal(); } }; 수행내용 1 북쪽터널입구에도착한경우 - 남쪽에차량이있다면대기. - 차량이없다면차량대수변경 - 신호등변경. 2 남쪽터널입구에도착한경우 - 북쪽에차량이있다면대기. - 차량이없다면 Shared Value 변경 - 신호등변경. 3 북쪽에서출발하여남쪽에도착한경우 - Shared Value 변경 - 북쪽에남아있는차량수를확인. : 남아있다면현재신호등유지 : 없다면남쪽에대기하는차량에 signal 전송 4 남쪽에서출발하여북쪽에도착한경우 - Shared Value 변경 - 남쪽에남아있는차량수를확인. : 남아있다면현재신호등유지 : 없다면북쪽에대기하는차량에 signal 전송 23

24 생각하는철학자문제 Monitors 의예 (Cont d) 5명의철학자와 5개의포크철학자들은오직먹거나생각만함먹기위해서는좌 / 우양쪽의포크가반드시필요아무도먹지못하여굶어죽지않아야함서로아무것도못하는상태가되지않아야함 24

25 Monitors 의예 (Cont d) Monitor Solution of Dining Philosophers Thinking i test((i-1) mod n) test((i+1) mod n) p2 먹으려고할때 If i = 0: test p4, p1 (0 1) mod 5 = 4 (0 + 1) mod 5 = 1 If i = 1: test p0, p2 (1 1) mod 5 = 0 (1 + 1) mod 5 = 2 Thinking or Eating p1 p3 Thinking or Eating If i = 2: test p1, p3 (2-1) mod 5 = 1 (2 + 1) mod 5 = 3 p2, p3 을 test 함. If i =3: test p2, p4 (3-1) mod 5 = 2 (3 + 1) mod 5 = 4 p0 p4 n : 철학자의수 i : 식사를하려는철학자 If i = 4: test p3, p0 (4 1) mod 5 = 3 (4 + 1) mod 5 = 0 Test 한철학자가 EATING 이아니면 fork 를사용할수있음. 25

26 Monitors 의예 (Cont d) 생각하는철학자해결방법 식사하려는철학자좌우철학자가생각중이면식사가능식사가끝나면좌우철학자가식사할수있도록해준다. 생각하는철학자선언코드생각하는철학자실행코드 monitor diningphilosophers { status state[n]; condition self[n]; test(int i) public: diningphilosophers() { }; pickupforks(int i) { }; putdownforks(int i) { }; }; Philosophers(){ while(true) { pickupforks(i); putdownforks(i); } fork(philosophers, 0); fork(philosophers, 0): fork(philosophers, 0); fork(philosophers, 0); 26

27 #define N enum status(eating, HUNGRY, THINKING}; monitor diningphilosophers { status state[n]; condition self[n]; Monitors 의예 (Cont d) 생각하는철학자해결방법 test(int i) { if((state[(i-1) mod N]!= EATING) && (state[i] == HUNGRY) && (state[(i+1) mod N]!= EATING)) { state[i] = EATING; self[i].signal(); } }; public: Signal diningphilosophers() { // Initilization for(int i = 0; i < N; i++) state[i] = THINKING; }; Monitor Solution of Dining Philosophers 식사하려는철학자좌우의철학자상태를점검하고, 식사가가능하면시그널을전송한다. 철학자초기화. 모두생각하는상태. pickupforks(int i) { state[i] = HUNGRY; test(i); if(state[i]!= EATING) self[i].wait(); }; putdownforks(int i) { state[i] = THINKING; test((i-1) mod N); test((i+1) mod N); }; } PickUpForks: 상태변경. 좌우철학자확인. 현재식사중이아니면대기 putdownforks: 상태변경. 좌우철학자가식사하려고하면식사할수있도록한다. 27

28 Definition of IPC IPC 란? IPC (Inter-Process Communication) 프로세스간정보전달을위해서 Message 를사용하는메커니즘 IPC 의필요성 각각의스레드나프로세스는동기적인 ( 또는비동기적인 ) 공동작업을하기위해상호간에정보전달을할필요가있음 Signal, semaphore 등은하나의프로세스에서다른프로세스로정보를전달할수없음 Monitor 는정보를공유하나, Monitor 내의 shared memory 를통해서만가능. Shared Memory 로프로세스간의사소통을할수없는경우 OS 가 Shared Memory 를지원하지않을경우 보통지원안함 프로세스가네트워크상의서로다른 Machine 에존재할경우 28

29 Basic Mechanism of IPC Basic Mechanism IPC (Cont d) p 0 가 p 1 에게정보를복사하려면 Memory protection 을우회할필요가있음 원격지에정보를복사하기위해네트워크를사용해야함 p1 이이해할수있는형태로송신해야함 (message format) 공유될정보 Message 복사된정보 OS IPC Address Space for p 0 Mechanism Address Space for p 1 p1 은 message 가온것을알지못함 송신및수신여부인지필요 (protocol) 29

30 Message Format ( 구조적정보 ) Control information: 버퍼용량을벗어날경우 (Overflow) 처리. 메시지순서번호우선순위등. Header Message Type Destination ID Source ID Message Length Control Information Type 은동기화정보, 오류보고와같은특별한정보가들어있음을나타내는데필요 Body Message Contents 헤더가없는경우프로세스들이구현 (ex. Unix pipe) 30

31 필요성 Message Protocols Needs of Message Protocols Message 를주고받는각 Process 가서로에대해알아야전송및수신이가능. Sender 는 receiver 가 ready 상태인지또는 sender 가보낸정보를 receiver 가수신했는지를알아야함 Message system 은 protocol 을명세함 Message 의전송과수신시에공통된형태가필요하고, receiver 는 sender 가보낸정보를해석할수있어야함 Standard header 가필요. Message Queue Semaphore Shared Memory <sys/msg.h> <sys/sem.h> <sys/shm.h> 31

32 Transmit Operations Asynchronous Send Message 전송후, 코드를계속실행. Receiver로부터정보가전달되었다는 feedback이없음 장점 : 전송후에다른작업처리가능. 단점 : 정상전송이되었는지알수없음. Synchronous send Two Message Transmit Methods Message 전송후, 메시지를받을때까지 sender 는 block 됨 장점 : Message의정상처리와오류제어를할수있음. 단점 : Message를받을때까지불특정시간을대기해야함. Message를 mailbox에전달하고, sender는실행을재개 - 약한동기화실제로 receiver가 mailbox에서꺼낼때실행을재개 - 강력한동기화 32

33 Blocking receive: Receive Operation Mailbox 에 Message 가없다면, receiver 는 Message 가도착할때가지 block 장점 : 정확한 Message 의수신가능. ( 오류제어 ) 단점 : 전송수단의문제발생시불특정시간동안대기해야함. Nonblocking receive: Mailbox 에 Message 가없다면, 이상황에대한 error 값반환 장점 : Process 는지속적으로작업가능. Two Message Receive Methods 단점 : Message 가도착하지못한경우처리불가능상태가됨. 33

34 Message Send Using Synchronized Transmit and Block Receive Synchronized IPC Code for p 1 Code for p 2 /* signal p 2 */ syncsend(message1, p2); <waiting >; /* wait for signal from p2 */ blockreceive(msgbuff, &from); /* wait for signal from p 1 */ blockreceive(msgbuff, &from); <process message>; /* signal p 1 */ syncsend(message2, p1); p1 p2 syncsend( ) blockreceive( ) waiting blockreceive( ) syncsend( ) 34

35 Message Send Using Asynchronized Transmit and Nonblock Receive Asynchronous IPC Code for p 1 Code for p 2 /* signal p 2 */ asyncsend(message 1, p 2 ); <other processing>; /* wait for signal from p 2 */ while(!nbreceive(&msg, &from)); p1 asyncsend( ) nonblockreceive( ) nonblockreceive( ) /* test for signal from p 1 */ if(nbreceive(&msg, &from)) { <process message>; asyncsend(message 2, p 1 ); }else{ <other processing>; } p2 nonblockreceive( ) nonblockreceive( ) asyncsend( ) 35

36 Mailbox in Process Mailbox Mechanism in Process Mailbox는일종의 Message Queue로 IPC의하나임. p 1 s address space는 compiler나 loader에의해할당됨부주의한 Mailbox영역사용을피해야함 p 1 의접근 Address Space for p 0 Address Space for p 1 Mailbox for p 1 Info to be shared Message Message Message Info copy send( p 1, ); receive( ); send function - System Call OS Interface p 1 프로세스내에 mailbox 가있기떄문에 library 로도가능 receive function 36

37 Mailbox Mechanism in OS Mailbox in OS OS 가 Mailbox 를관리하여더안전한메시지전송이가능. - p 1 이 mailbox 접근불가 정보의복사를위해 Memory protection 을우회할필요가없음 Address Space for p 0 Address Space for p 1 공유될정보 send( p 1, ); 단점 - 모드전환이많이일어남 - OS 에필요한공간이증가 OS Interface 복사된정보 receive( ); Mailbox for p 1 send function Message Message Message receive function 37

38 Definition of Pipe Pipe 란 UNIX Pipe OS 가제공하는단방향통로를이용하여 Message 를전송하는 IPC 의하나임. 방향성이있어한번에한방향으로만데이터전송이가능. Address Space for p 1 공유될정보 write(pipe[1], ); pip 생성 ( 선언 ) 으로 핸들러얻음 System Call Interface 복사된정보 read(pipe[0]); write function pipe for p 1 and p 2 read function 38

39 Interface and Execution of Pipe UNIX Pipe (cont d) 파이프인터페이스는파일인터페이스와유사함 open과유사한 pipe 시스템콜을사용해서파이프를생성. File read/write 시스템콜을사용하여정보를받거나보냄 파이프를사용할때일어나는일 파이프가생성될때커널은하나의버퍼생성 프로세스들은 read/write 시스템콜을사용해서버퍼에서정보를읽어오거나자신의주소영역에서버퍼로정보를쓸수있음 39

40 Read/Write Method of Pipe fork() 시스템콜에의해서생성된자식프로세스는부모프로세스와파일 handler 를공유함 pipeid[0] 은파이프에서읽기위한 handler pipeid[1] 은파이프에쓰기위한 handler Read/Write Method of Pipe int pipeid[2]; pipe(pipeid); if(fork() == 0) { /* the child */ read(pipeid[0], childbuf, len); <process the message>; } else { /* the parent */ write(pipeid[1], msgtochild, len); } 40

41 Read/Write Method of Pipe ( con t) write() 는비동기적인 operation 임 write 할수없을경우 error 값을돌려줌 Non-blocking Read Method of Pipe 일반적으로 read는 blocking read read operation은 non-blocking read일수있음 #include <sys/ioctl.h> int pipeid[2]; pipe(pipeid); ioctl(pipeid[0], FIONBIO, &on); read(pipeid[0], buffer, len); if(errno!= EWOULDBLOCK) { /* no data */ } else { /* have data */ 41

10주차.key

10주차.key 10, Process synchronization (concurrently) ( ) => critical section ( ) / =>, A, B / Race condition int counter; Process A { counter++; } Process B { counter ;.. } counter++ register1 = counter register1

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

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

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

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

좀비프로세스 2

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

More information

Abstract View of System Components

Abstract View of System Components 운영체제실습 - Synchronization - Real-Time Computing and Communications Lab. Hanyang University jtlim@rtcc.hanyang.ac.kr dhchoi@rtcc.hanyang.ac.kr beespjh@gmail.com Introduction 조교소개 이름 : 임정택 Tel : 010-4780

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

제11장 프로세스와 쓰레드

제11장 프로세스와 쓰레드 제9장자바쓰레드 9.1 Thread 기초 (1/5) 프로그램 명령어들의연속 (a sequence of instruction) 프로세스 / Thread 실행중인프로그램 (program in execution) 프로세스생성과실행을위한함수들 자바 Thread 2 9.1 Thread 기초 (2/5) 프로세스단위작업의문제점 프로세스생성시오버헤드 컨텍스트스위치오버헤드

More information

Microsoft PowerPoint - o6.pptx

Microsoft PowerPoint - o6.pptx Dining-Philosophers Problem 세마포사용 Semaphore chopstick[5] = {1,1,1,1,1} ; // initially all values are 1 Philosopher i while (true) { P(chopStick[i]); // get left chopstick P(chopStick[(i+1) % 5]); // get

More information

Microsoft PowerPoint - o6.pptx

Microsoft PowerPoint - o6.pptx Dining-Philosophers Problem 세마포사용 6.8 모니터 (Monitors) Semaphore chopstick[5] = {1,1,1,1,1 ; // initially all values are 1 Philosopher i while (true) { P(chopStick[i]); // get left chopstick P(chopStick[(i+1)

More information

Chap04(Signals and Sessions).PDF

Chap04(Signals and Sessions).PDF Signals and Session Management 2002 2 Hyun-Ju Park (Signal)? Introduction (1) mechanism events : asynchronous events - interrupt signal from users : synchronous events - exceptions (accessing an illegal

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 - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

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

C# Programming Guide - Types

C# Programming Guide - Types C# Programming Guide - Types 최도경 lifeisforu@wemade.com 이문서는 MSDN 의 Types 를요약하고보충한것입니다. http://msdn.microsoft.com/enus/library/ms173104(v=vs.100).aspx Types, Variables, and Values C# 은 type 에민감한언어이다. 모든

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D> 뻔뻔한 AVR 프로그래밍 The Last(8 th ) Lecture 유명환 ( yoo@netplug.co.kr) INDEX 1 I 2 C 통신이야기 2 ATmega128 TWI(I 2 C) 구조분석 4 ATmega128 TWI(I 2 C) 실습 : AT24C16 1 I 2 C 통신이야기 I 2 C Inter IC Bus 어떤 IC들간에도공통적으로통할수있는 ex)

More information

Microsoft PowerPoint - 10_Signal

Microsoft PowerPoint - 10_Signal Operating System Laboratory 시그널 - IPC - 시그널의종류 - 시그널구현함수 IPC 프로세스간통신 (Inter-Process Communication) 실행중인프로세스간에데이터를주고받는기법 IPC 에는매우많은방법이있다! File Pipe/Named pipe Socket Shared memory Message passing Remote

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

Microsoft PowerPoint APUE(Intro).ppt

Microsoft PowerPoint APUE(Intro).ppt 컴퓨터특강 () [Ch. 1 & Ch. 2] 2006 년봄학기 문양세강원대학교컴퓨터과학과 APUE 강의목적 UNIX 시스템프로그래밍 file, process, signal, network programming UNIX 시스템의체계적이해 시스템프로그래밍능력향상 Page 2 1 APUE 강의동기 UNIX 는인기있는운영체제 서버시스템 ( 웹서버, 데이터베이스서버

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

제1장 Unix란 무엇인가?

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

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

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

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

More information

SRC PLUS 제어기 MANUAL

SRC PLUS 제어기 MANUAL ,,,, DE FIN E I N T R E A L L O C E N D SU B E N D S U B M O TIO

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

o o o 8.2.1. Host Error 8.2.2. Message Error 8.2.3. Recipient Error 8.2.4. Error 8.2.5. Host 8.5.1. Rule 8.5.2. Error 8.5.3. Retry Rule 8.11.1. Intermittently

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

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Function) 1. 함수의개념 입력에대해적절한출력을발생시켜주는것 내가 ( 프로그래머 ) 작성한명령문을연산, 처리, 실행해주는부분 ( 모듈 ) 자체적으로실행되지않으며,

More information

PowerPoint Presentation

PowerPoint Presentation Class - Property Jo, Heeseung 목차 section 1 클래스의일반구조 section 2 클래스선언 section 3 객체의생성 section 4 멤버변수 4-1 객체변수 4-2 클래스변수 4-3 종단 (final) 변수 4-4 멤버변수접근방법 section 5 멤버변수접근한정자 5-1 public 5-2 private 5-3 한정자없음

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 4 (Object) (Class) (Instance) (Method) (Constructor) Memory 1 UML 1 @ & 1 (Real World) (Software World) @ &.. () () @ & 2 (Real World) (Software World) OOA/ Modeling Abstraction Instantiation

More information

Something that can be seen, touched or otherwise sensed

Something that can be seen, touched or otherwise sensed Something that can be seen, touched or otherwise sensed Things about an object Weight Height Material Things an object does Pen writes Book stores words Water have Fresh water Rivers Oceans have

More information

Microsoft PowerPoint - StallingsOS6e-Chap05.pptx

Microsoft PowerPoint - StallingsOS6e-Chap05.pptx 5 장병행성 : 상호배제와동기화 5 장의강의목표 병행성 (concurrency) 의원리와주요용어를이해한다. 경쟁상태 (race condition) 의문제점에대해이해한다. 상호배제 (mutual exclusion), 교착상태 (deadlock), 기아상태 (starvation) 의 3 가지제어문제를이해한다. 상호배제를보장하기위한하드웨어적접근방법을이해한다. 세마포어를이용한상호배제기법을이해한다.

More information

System Programming Lab

System Programming Lab System Programming Lab Week 4: Shell Schedule for your own shell 1 st shell 기본기능 fork / exec Background Processing/ Sequential Execution ls, find, grep 2 nd Environment variables/ Shell variables built-in

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

<4D F736F F F696E74202D20B8B6C0CCC5A9B7CEC7C1B7CEBCBCBCAD202839C1D6C2F7207E203135C1D6C2F >

<4D F736F F F696E74202D20B8B6C0CCC5A9B7CEC7C1B7CEBCBCBCAD202839C1D6C2F7207E203135C1D6C2F > 10주차 문자 LCD 의인터페이스회로및구동함수 Next-Generation Networks Lab. 5. 16x2 CLCD 모듈 (HY-1602H-803) 그림 11-18 19 핀설명표 11-11 번호 분류 핀이름 레벨 (V) 기능 1 V SS or GND 0 GND 전원 2 V Power DD or V CC +5 CLCD 구동전원 3 V 0 - CLCD 명암조절

More information

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

Microsoft PowerPoint - StallingsOS6e-Chap06.ppt [호환 모드] 6 장병행성 : 교착상태와기아 6 장의강의목표 교착상태 (deadlock) 의원리를이해한다. 교착상태에자원할당그래프가어떻게이용되는지이해한다. 교착상태가발생하기위한필요. 충분조건을이해한다. 교착상태예방기법들을이해한다. 교착상태회피기법들을이해한다. 교착상태의발견과복구기법들을이해한다. 식사하는철학자문제를이해하고해결방법을이해한다. UNIX, LINUX, Solaris,

More information

C++ Programming

C++ Programming C++ Programming 예외처리 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 예외처리 2 예외처리 예외처리 C++ 의예외처리 예외클래스와객체 3 예외처리 예외를처리하지않는프로그램 int main() int a, b; cout > a >> b; cout

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

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt 변수와상수 1 변수란무엇인가? 변수 : 정보 (data) 를저장하는컴퓨터내의특정위치 ( 임시저장공간 ) 메모리, register 메모리주소 101 번지 102 번지 변수의크기에따라 주로 byte 단위 메모리 2 기본적인변수형및변수의크기 변수의크기 해당컴퓨터에서는항상일정 컴퓨터마다다를수있음 short

More information

슬라이드 1

슬라이드 1 UNIT 16 예외처리 로봇 SW 교육원 3 기 최상훈 학습목표 2 예외처리구문 try-catch-finally 문을사용핛수있다. 프로그램오류 3 프로그램오류의종류 컴파일에러 (compile-time error) : 컴파일실행시발생 럮타임에러 (runtime error) : 프로그램실행시발생 에러 (error) 프로그램코드에의해서해결될수없는심각핚오류 ex)

More information

Synchronization

Synchronization Synchronization Command Execution 명령어수행과운영체제 UNIX: 프로그램이실행한프로세스가종료될때까지대기 Windows: 실행된모든프로세스는각자수행 Enter Loop Enter Loop Yes Another Command? No fork()code Exit Loop Yes Another Command? No Exit Loop CreateProcess()code

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 실습 1 배효철 th1g@nate.com 1 목차 조건문 반복문 System.out 구구단 모양만들기 Up & Down 2 조건문 조건문의종류 If, switch If 문 조건식결과따라중괄호 { 블록을실행할지여부결정할때사용 조건식 true 또는 false값을산출할수있는연산식 boolean 변수 조건식이 true이면블록실행하고 false 이면블록실행하지않음 3

More information

PCServerMgmt7

PCServerMgmt7 Web Windows NT/2000 Server DP&NM Lab 1 Contents 2 Windows NT Service Provider Management Application Web UI 3 . PC,, Client/Server Network 4 (1),,, PC Mainframe PC Backbone Server TCP/IP DCS PLC Network

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 시그널 2 11.1 시그널 시그널 시그널은예기치않은사건이발생할때이를알리는소프트웨어인터럽트이다. 시그널발생예 SIGFPE 부동소수점오류 SIGPWR 정전 SIGALRM 알람시계울림 SIGCHLD 자식프로세스종료 SIGINT 키보드로부터종료요청 (Ctrl-C) SIGSTP 키보드로부터정지요청 (Ctrl-Z) 3 주요시그널 시그널이름 의미 기본처리 SIGABRT

More information

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Crash Unity SDK... Log & Crash Search. - Unity3D v4.0 ios

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

C프로-3장c03逞풚

C프로-3장c03逞풚 C h a p t e r 03 C++ 3 1 9 4 3 break continue 2 110 if if else if else switch 1 if if if 3 1 1 if 2 2 3 if if 1 2 111 01 #include 02 using namespace std; 03 void main( ) 04 { 05 int x; 06 07

More information

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 객체지향프로그래밍 IT CookBook, 자바로배우는쉬운자료구조 q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 q 객체지향프로그래밍의이해 v 프로그래밍기법의발달 A 군의사업발전 1 단계 구조적프로그래밍방식 3 q 객체지향프로그래밍의이해 A 군의사업발전 2 단계 객체지향프로그래밍방식 4 q 객체지향프로그래밍의이해 v 객체란무엇인가

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

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

Microsoft PowerPoint - additional01.ppt [호환 모드]

Microsoft PowerPoint - additional01.ppt [호환 모드] 1.C 기반의 C++ part 1 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 함수 Jong Hyuk Park 함수오버로딩 (overloading) 함수오버로딩 (function overloading) C++ 언어에서는같은이름을가진여러개의함수를정의가능

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

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

본 강의에 들어가기 전

본 강의에 들어가기 전 유닉스프로그래밍및실습 9 장. 시그널 1. 시그널개념 시그널생명주기 시그널이발생한다. 커널이해당시그널을쌓아둔다.( 동일한시그널이오는경우하나만 ) 가능한시점에서커널이적절하게처리한다 커널의처리방법 시그널무시 아무런동작을하지않는다 절대무시할수없는시그널 SIGKILL SIGSTOP 시그널을붙잡아처리 현재코드경로를따라가는실행을중단하고, 시그널마다등록된함수로점프 기본동작

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

untitled

untitled Push... 2 Push... 4 Push... 5 Push... 13 Push... 15 1 FORCS Co., LTD A Leader of Enterprise e-business Solution Push (Daemon ), Push Push Observer. Push., Observer. Session. Thread Thread. Observer ID.

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 13 장파일처리 1. 스트림의개념을이해한다. 2. 객체지향적인방법을사용하여파일입출력을할수있다. 3. 텍스트파일과이진파일의차이점을이해한다. 4. 순차파일과임의접근파일의차이점을이해한다. 이번장에서만들어볼프로그램 스트림 (stream) 스트림 (stream) 은 순서가있는데이터의연속적인흐름 이다. 스트림은입출력을물의흐름처럼간주하는것이다. 입출력관련클래스들 파일쓰기

More information

제9장 프로세스 제어

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

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 - Java7.pptx

Microsoft PowerPoint - Java7.pptx HPC & OT Lab. 1 HPC & OT Lab. 2 실습 7 주차 Jin-Ho, Jang M.S. Hanyang Univ. HPC&OT Lab. jinhoyo@nate.com HPC & OT Lab. 3 Component Structure 객체 (object) 생성개념을이해한다. 외부클래스에대한접근방법을이해한다. 접근제어자 (public & private)

More information

JAVA PROGRAMMING 실습 08.다형성

JAVA PROGRAMMING 실습 08.다형성 2015 학년도 2 학기 1. 추상메소드 선언은되어있으나코드구현되어있지않은메소드 abstract 키워드사용 메소드타입, 이름, 매개변수리스트만선언 public abstract String getname(); public abstract void setname(string s); 2. 추상클래스 abstract 키워드로선언한클래스 종류 추상메소드를포함하는클래스

More information

<4D F736F F F696E74202D BDC3B1D7B3CEB0FA20BDC3B1D7B3CE20C3B3B8AE2E707074>

<4D F736F F F696E74202D BDC3B1D7B3CEB0FA20BDC3B1D7B3CE20C3B3B8AE2E707074> 10 장시그널과시그널처리 시그널과시그널처리 - sigemptyset, sigfillset - sigaddset, sigdelset, sigismember - sigaction - sigprocmask - kill, raise - alarm - pause 1 1. 서론 시그널의종류 이름설명 DA SIGABRT abort() 를호출할때발생 SIGALRM 설정된알람시간이경과한겨우발생

More information

Index Process Specification Data Dictionary

Index Process Specification Data Dictionary Index Process Specification Data Dictionary File Card Tag T-Money Control I n p u t/o u t p u t Card Tag save D e s c r i p t i o n 리더기위치, In/Out/No_Out. File Name customer file write/ company file write

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 필드만있는클래스 텔레비젼 2 예제 1. 필드만있는클래스 3 예제 2. 여러개의객체생성하기 4 5 예제 3. 메소드가추가된클래스 public class Television { int channel; // 채널번호 int volume; // 볼륨 boolean

More information

Infinity(∞) Strategy

Infinity(∞) Strategy 반복제어 표월성 passwd74@cherub.sungkyul.edu 개요 for() 문 break문과 continue문 while문 do-while문 for() 문 for() 문형식 for( 표현식1; 표현식2; 표현식3) 여러문장들 ; 표현식 1 : 초기화 (1 번만수행 ) 표현식 2 : 반복문수행조건 ( 없으면무한반복 ) 표현식 3 : 반복문수행횟수 for()

More information

슬라이드 1

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

More information

C++ Programming

C++ Programming C++ Programming 연산자다중정의 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 연산자다중정의 C++ 스타일의문자열 2 연산자다중정의 연산자다중정의 단항연산자다중정의 이항연산자다중정의 cin, cout 그리고 endl C++ 스타일의문자열 3 연산자다중정의 연산자다중정의 (Operator

More information

SMB_ICMP_UDP(huichang).PDF

SMB_ICMP_UDP(huichang).PDF SMB(Server Message Block) UDP(User Datagram Protocol) ICMP(Internet Control Message Protocol) SMB (Server Message Block) SMB? : Microsoft IBM, Intel,. Unix NFS. SMB client/server. Client server request

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 - 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

1

1 1 1....6 1.1...6 2. Java Architecture...7 2.1 2SDK(Software Development Kit)...8 2.2 JRE(Java Runtime Environment)...9 2.3 (Java Virtual Machine, JVM)...10 2.4 JVM...11 2.5 (runtime)jvm...12 2.5.1 2.5.2

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

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

JVM 메모리구조

JVM 메모리구조 조명이정도면괜찮조! 주제 JVM 메모리구조 설미라자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조장. 최지성자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조원 이용열자료조사, 자료작성, PPT 작성, 보고서작성. 이윤경 자료조사, 자료작성, PPT작성, 보고서작성. 이수은 자료조사, 자료작성, PPT작성, 보고서작성. 발표일 2013. 05.

More information

hlogin2

hlogin2 0x02. Stack Corruption off-limit Kernel Stack libc Heap BSS Data Code off-limit Kernel Kernel : OS Stack libc Heap BSS Data Code Stack : libc : Heap : BSS, Data : bss Code : off-limit Kernel Kernel : OS

More information

chap x: G입력

chap x: G입력 재귀알고리즘 (Recursive Algorithms) 재귀알고리즘의특징 문제자체가재귀적일경우적합 ( 예 : 피보나치수열 ) 이해하기가용이하나, 비효율적일수있음 재귀알고리즘을작성하는방법 재귀호출을종료하는경계조건을설정 각단계마다경계조건에접근하도록알고리즘의재귀호출 재귀알고리즘의두가지예 이진검색 순열 (Permutations) 1 장. 기본개념 (Page 19) 이진검색의재귀알고리즘

More information

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.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 학습목표 을 작성하면서 C 프로그램의

More information

윤성우의 열혈 TCP/IP 소켓 프로그래밍

윤성우의 열혈 TCP/IP 소켓 프로그래밍 C 프로그래밍프로젝트 Chap 22. 구조체와사용자정의자료형 1 2013.10.10. 오병우 컴퓨터공학과 구조체의정의 (Structure) 구조체 하나이상의기본자료형을기반으로사용자정의자료형 (User Defined Data Type) 을만들수있는문법요소 배열 vs. 구조체 배열 : 한가지자료형의집합 구조체 : 여러가지자료형의집합 사용자정의자료형 struct

More information

C 프로그래밍 언어 입문 C 프로그래밍 언어 입문 김명호저 숭실대학교 출판국 머리말..... C, C++, Java, Fortran, Python, Ruby,.. C. C 1972. 40 C.. C. 1999 C99. C99. C. C. C., kmh ssu.ac.kr.. ,. 2013 12 Contents 1장 프로그래밍 시작 1.1 C 10 1.2 12

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

슬라이드 1

슬라이드 1 Pairwise Tool & Pairwise Test NuSRS 200511305 김성규 200511306 김성훈 200614164 김효석 200611124 유성배 200518036 곡진화 2 PICT Pairwise Tool - PICT Microsoft 의 Command-line 기반의 Free Software www.pairwise.org 에서다운로드후설치

More information

rmi_박준용_final.PDF

rmi_박준용_final.PDF (RMI) - JSTORM http://wwwjstormpekr (RMI)- Document title: Document file name: Revision number: Issued by: Document Information (RMI)- rmi finaldoc Issue Date: Status:

More information

Microsoft Word - ASG AT90CAN128 모듈.doc

Microsoft Word - ASG AT90CAN128 모듈.doc ASG AT90128 Project 3 rd Team Author Cho Chang yeon Date 2006-07-31 Contents 1 Introduction... 3 2 Schematic Revision... 4 3 Library... 5 3.1 1: 1 Communication... 5 iprinceps - 2-2006/07/31

More information

(SW3704) Gingerbread Source Build & Working Guide

(SW3704) Gingerbread Source Build & Working Guide (Mango-M32F4) Test Guide http://www.mangoboard.com/ http://cafe.naver.com/embeddedcrazyboys Crazy Embedded Laboratory www.mangoboard.com cafe.naver.com/embeddedcrazyboys CRZ Technology 1 Document History

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

Microsoft PowerPoint - o8.pptx

Microsoft PowerPoint - o8.pptx 메모리보호 (Memory Protection) 메모리보호를위해 page table entry에 protection bit와 valid bit 추가 Protection bits read-write / read-only / executable-only 정의 page 단위의 memory protection 제공 Valid bit (or valid-invalid bit)

More information

No Slide Title

No Slide Title Copyright, 2001 Multimedia Lab., CH 3. COM object (In-process server) Eun-sung Lee twoss@mmlab.net Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul Seoul, Korea 0. Contents 1.

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

More information

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D>

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

More information

CD-RW_Advanced.PDF

CD-RW_Advanced.PDF HP CD-Writer Program User Guide - - Ver. 2.0 HP CD-RW Adaptec Easy CD Creator Copier, Direct CD. HP CD-RW,. Easy CD Creator 3.5C, Direct CD 3.0., HP. HP CD-RW TEAM ( 02-3270-0803 ) < > 1. CD...3 CD...5

More information

Microsoft Word - FunctionCall

Microsoft Word - FunctionCall Function all Mechanism /* Simple Program */ #define get_int() IN KEYOARD #define put_int(val) LD A val \ OUT MONITOR int add_two(int a, int b) { int tmp; tmp = a+b; return tmp; } local auto variable stack

More information

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for 2003 Development of the Software Generation Method using Model Driven Software Engineering Tool,,,,, Hoon-Seon Chang, Jae-Cheon Jung, Jae-Hack Kim Hee-Hwan Han, Do-Yeon Kim, Young-Woo Chang Wang Sik, Moon

More information

11장 포인터

11장 포인터 누구나즐기는 C 언어콘서트 제 9 장포인터 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 포인터란? 포인터 (pointer): 주소를가지고있는변수 메모리의구조 변수는메모리에저장된다. 메모리는바이트단위로액세스된다. 첫번째바이트의주소는 0, 두번째바이트는 1, 변수와메모리

More information