thread

    java, notify에 대해서.

    notify에 대해서 살펴봣었다. 즉, signal의 역활을 하는 것인데 java에서는 thread의 priority를 정할 수 있다.그래서 priority가 높은 것일 수록 먼저 호출이 되는데, 이 priority는 set으로 정할 수 있다. norify에 대한 아주 간단한 예제이다.이 예제에서 사용된 개념은 wait과 notify이다. Bank.java public class Bank { public synchronized void in() { int i=0; System.out.println("**** in start ****"); while(true) { System.out.println("in "+(i++)); try { if (i==20) { System.out.println("start wa..

    thread fool에 대해서 알아보자.

    1. 키워드thread,fool,스레드,풀,pthread 2.우선 wikipedia를 보자.http://en.wikipedia.org/wiki/Thread_pool_pattern 3.wiki의 내용에 기초해서 보자면이 thread pool patern을 적용할 때는 thread-safety가 확보되어 있어야 한다.자바의 경우엔 synchronized라는 키워드를 사용해서 보호한다. 4.간단한 예제가 있다.http://software.intel.com/sites/products/documentation/studio/composer/en-acus/2011Update/compiler_c/optaps/common/optaps_par_multicore_thrdpool.htm여기선 예제로 초기화 하는 부분만 예를 ..

    [c언어] thread의 상태를 확인해보자

    1.thread를 관리하는데 thread의 id인 pid를 통해 관리할 수 있지 않을까라는 발상에서 시작. 2.googling하니깐 나온다. 'c check pid status' (https://www.google.com/webhp?hl=en#hl=en&newwindow=1&q=c%20check%20pid%20status&safe=off) 순조로운데? 3.여기에 다 나와있다. 본인의 pid나 parent의 pid를 확인 할 수 있다. Kann es auch und macht es nicht C++:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31#include #include #include #includ..

    [c++] fwrite의 thread-safety란

    1.fwrite의 기능은 thread에 safety하지 못한가?구글링을 해보니깐 thread-safe와 atomic이란 두개의 개념이 존재했다. 이것 먼저 집고 가자. 2. thread-safe란멀티 thread에 의한 동시에 작업되는 공간에서 보장된 신뢰도 있는 작업을 할 수 있는 데이터 구조에 대한 것을 의미한다.(http://en.wikipedia.org/wiki/Thread_safety) 3. atomic이란대략 자원경쟁을 막는 하나의 데이터를 보호하는 것같은데.. 찾기가 어렵네;(http://2cpu.co.kr/bbs/board.php?bo_table=QnA&wr_id=286485) 정리 : atomic이란 원자와 같은 성질을 같은 구조로 thread safety도 만족하면서 예상되는 결과도 보..

    [c++] thread 기본 구조, 모양

    1. thread에 함수 넣는 부분에 &를 붇이지 않아도 함수 이름이 갖고 있는 해당 메모리 주소로 인식된다는 말을 듣고 해보았지만 에러가 떠서 이것 저것 찾다가 그냥 예시를 찾았다. 2.#include #include #include #include void* print(void* data){ std::cout