Module 7: Process Synchronization

Size: px
Start display at page:

Download "Module 7: Process Synchronization"

Transcription

1 Chapter 6: Process Synchronization ( 프로세스동기화 ), Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

2 Module 6: Synchronization( 동기화 ) Background( 배경 ) The Critical-Section Problem( 임계구역문제 ) Peterson s Solution( 피터슨솔루션 ) Synchronization Hardware( 동기화하드웨어 ) Semaphores( 세마포 ) Classic Problems of Synchronization( 고전적동기화문제들 ) Monitors( 모니터 ) Synchronization Examples ( 동기화사례 ) Atomic Transactions( 원자적트랜잭션 ) 6.2 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

3 Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data( 공유데이터의일관성을보장하기위한임계구역문제소개 ) To present both software and hardware solutions of the critical-section problem( 임계구역문제의소프트웨어및하드웨어솔루션 ) To introduce the concept of an atomic transaction and describe mechanisms to ensure atomicity( 원자적트랜잭션의개념을소개하고원자성을보장하기위한매카니즘을기술한다.) 6.3 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

4 Background Concurrent access to shared data may result in data inconsistency ( 공유데이터의동시접근은데이터의불일치를초래할수있다.) Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes ( 데이터의일관성을유지하기위해서는프로세스들의실행순서를보증하는메커니즘이요구된다.) Suppose that we wanted to provide a solution to the consumerproducer problem that fills all the buffers. We can do so by having an integer count that keeps track of the number of full buffers. Initially, count is set to 0. It is incremented by the producer after it produces a new buffer and is decremented by the consumer after it consumes a buffer. ( 모든버퍼를사용하는소비자 - 생산자문제에서 count 변수를이용하여소비실행순서를보증하였다.) 6.4 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

5 Previous Producer-Consumer (3.4.1) Bounded Shared Buffer Producer process item nextproduced; while (true) { /* Produce an item in nextproduced */ while ((((in + 1) % BUFFER_SIZE) == out) ; /* do nothing -- no free buffers */ buffer[in] = nextproduced; in = (in + 1) % BUFFER SIZE; Shared Data Consumer process item nextconsumed; while (true) { while (in == out) ; // do nothing -- nothing to consume nextconsumed = buffer[out]; // remove an item from the buffer out = (out + 1) % BUFFER SIZE; /* consume the item in nextconsume */ At most BUFFER_SIZE-1 items in the buffer of BUFFER_SIZE #define BUFFER_SIZE 10 typedef struct {... item; item buffer[buffer_size]; int in = 0; //used by producer int out = 0; //used by consumer 6.5 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

6 Previous Producer-Consumer (3.4.1) New Shared Buffer with counter Producer process while (true) { /* produce an item and put in nextproduced */ while (count == BUFFER_SIZE) ; // do nothing buffer [in] = nextproduced; in = (in + 1) % BUFFER_SIZE; count++; Consumer process while (true) { while (count == 0) ; // do nothing nextconsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; count--; /* consume the item in nextconsumed Allow full buffer, BUFFER_SIZE items in the buffer of BUFFER_SIZE Modified Producer Consumer define BUFFER_SIZE 10 typedef struct {... item; item buffer[buffer_size]; int in = 0; int out = 0; int counter = 0; 6.6 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

7 Bounded Buffer The statements counter++; counter--; must be performed atomically ( 원자적으로연산되어야한다.) Atomic operation means an operation that completes in its entirety without interruption ( 원자연산은외부의인터럽트없이완전히실행되는연산이다.) 6.7 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

8 Race Condition( 경합상태 ) 경합상태 (race condition) : 두개의프로세스가경쟁적으로한변수를조작 ( 예 ) 공유변수 count 의변경명령이동시에수행될경우불일치발생 생산자의 count ++ register1 = count; register1 = register1 + 1; count = register1; 소비자의 counter -- register2 = count; register2 = register2-1; count = register2; 병행실행 (concurrent execution) T0: 생산자 register1 := count {register1 = 5 T1: 생산자 register1 : = register1 + 1 {register1 = 6 T2: 소비자 register2 := count {register2 = 5 T3: 소비자 register2 := register2-1 {register2 = 4 T4: 생산자 count := register1 {counter = 6 T5: 소비자 count := register2 {counter = 4 한 process 만접근하게해야함 6.8 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

9 An Example Withdraw money from a bank account( 은행계좌인출문제 ) Suppose you and your girl(boy) friend share a bank account with a balance of 1,000,000won What happens if both go to separate ATM machines, and simultaneously withdraw 100,000won from the account? ( 은행의 100 만원을두사람이다른 ATM 에서인출을동시에시도한다 ) int withdraw (account, amount) { balance = get_balance (account); balance = balance - amount; put_balance (account, balance); return balance; 6.9 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

10 An Example (Cont d) Interleaved schedules Represent the situation by creating a separate thread for each person to do the withdrawals The execution of the two threads can be interleaved, assuming preemptive scheduling: 6.10 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

11 Solution to Critical-Section Problem( 임계구역문제 ) 임계구역 프로세스가공유자료를변경하는코드영역 상호배타적 (mutually exclusive) 이어야함 프로세스구조 진입구역 (entry section) : 진입허가요청 ( 한프로세스만실행 ) 출구구역 (exit section) 잔류구역 (remainder section) 임계구역해결을위한 3 요구조건 (requirements) R1. 상호배제 (mutual exclusion): 한프로세스만임계구역진입 R2. 진행 (progress): 자연스럽게막힘이없이진행, 임계구역에진입할프로세스선택이영원히지연되지않음 R3. 한계대기 (bounded waiting): 한프로세스가임계구역진입요청후기다리는데한계가있음 (no starvation) 기본기계명령어들 (load, store, test) 들은원자적으로실행됨 (executed atomically) 을가정 6.11 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

12 Solution to Critical-Section Problem General structure for a typical process Pi do { entry section exit section critical section remainder section while (TRUE); 6.12 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

13 Mechanisms for Critical Sections Locks Very primitive, minimal semantics, used to build others Semaphores Basic, easy to get the hang of, hard to program with Monitors High-level, requires language support, implicit operations Easy to program with: Java synchronized Messages Simple model of communication and synchronization based on (atomic) transfer of data across a channel Direct application to distributed systems 6.13 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

14 Locks Very primitive, minimal semantics, used to build others Software Solutions Peterson s Solution for two process Bakery Algorithm for n processes Hardware Solutions Mutual Exclusion solution using TestAndSet Mutual Exclusion Solution using Swap Instruction Bounded Mutual Exclusion solution using TestAndSet 6.14 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

15 Locks A lock is an object (in memory) that provides the following two operations: acquire(): wait until lock is free, then grab it (lock 가해제될때까지가다린후해제되면잡는다 ) release(): unlock, and wake up any thread waiting in acquire() ( 해제, 대기중인쓰레드를활성화한다 ) Using locks Lock is initially free Call acquire() before entering a critical section, and release() after leaving it Between acquire() and release(), the thread holds the lock acquire() does not return until the caller holds the lock At most one thread can hold a lock at a time Locks can spin (a spinlock) or block (a mutex) A mutex is an object in a program that serves as a lock and used to negotiate mutual exclusion among threads / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

16 Using Locks 6.16 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

17 Implementing Locks (Cont d) Problem Implementation of locks has a critical section, too! The acquire/release must be atomic A recursion, huh? Atomic operation Executes as though it could not be interrupted Code that executes all or nothing Solutions Software-only algorithms Algorithm for two processes Bakery algorithm for more than two processes Hardware atomic instructions Test-and-set, compare-and-swap, etc. Disable/re-enable interrupts To prevent context switches 6.17 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

18 Initial Attempts to Solve Problem Only 2 processes, P0 and P1 General structure of process Pi (other process Pj) do { entry section critical section exit section remainder section while (1); Processes may share some common variables to synchronize their actions Entry section Acquire a lock Exit section Release a lock 6.18 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

19 Peterson s Solution(software) 2개프로세스의 S/W 임계구역문제해법 LOAD 와 STORE 명령은원자적 (atomic) 즉, 수행도중절대인터럽트되지않음 2개프로세스가아래 2개변수공유 : int turn; Boolean flag[2] 변수 turn 은어느임계구역진입순번표시 The flag 배열은임계구역진입준비됨표시 flag[i] = true 는 process P i 가준비되었음! 6.19 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

20 Algorithm for Process P i in Peterson s solution The structure of process Pi do { flag[i] = TRUE; turn = j; //trigger Pj while (flag[j] && turn == j); critical section flag[i] = FALSE; remainder section while (TRUE); The structure of process Pj do { flag[j] = TRUE; turn = i; //trigger Pi while (flag[i] && turn == i); flag[j] = FALSE; while (TRUE); critical section remainder section Pi enter CS only when frag[j]==false or turn==i 동시시도시 frag[i]==frag[j]==true => turn 값배타적, 상대방 trigger 6.20 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

21 Bakery Algorithm Critical section for n processes(n 개프로세스에대한임계구역문제 ) Before entering its critical section, process receives a number. Holder of the smallest number enters the critical section If processes Pi and Pj receive the same number, if i < j, then Pi is served first; else Pj is served first The numbering scheme always generates numbers in increasing order of enumeration; i.e., 1,2,3,3,3,3,4,5... 최소번호수령 작은번호를받은프로세스가먼저실행한다 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

22 Bakery Algorithm Notation < lexicographical order (ticket #, process id #) (a,b) < (c,d) if a < c or if a = c and b < d max (a 0,, a n-1 ) is a number, k, such that k >= a i for i = 0,, n 1 Shared data boolean choosing[process]; // 우선순위받는기간의미 int priority[process]; // process : process id # Data structures are initialized to false and 0 respectively 6.22 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

23 Bakery Algorithm Shared Varialbes boolean choosing[p]; // 우선순위받기위한대기상태 int priority[p]; // p : process id initially choosing[..]=false; prioty[..]=0; do { choosing[p] = true; // 프로세스 p 가우선순위받는모드진입 priority [p] = max(priority[0], priority[1],, priority[n 1])+1; choosing[p] = false; // // 프로세스 p 가우선순위받는모드종료 for (j = 0; j < n; j++) { while (choosing[j]) ; // 우선순위받는중이면대기 while ((priority[j]!= 0) && ((priority[j],j)< (priority[p], p))) ; critical section priority[p] = 0; remainder section while (1); // 다른프로세스가우선하면그프로세스의처리까지대기 6.23 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

24 Synchronization Hardware Many systems provide hardware (instruction) support for critical section code Uniprocessors could disable interrupts( 입터럽트무력화 ) Currently running code would execute without preemption Generally too inefficient on multiprocessor systems Operating systems using this not broadly scalable Modern machines provide special atomic hardware instructions Atomic = non-interruptable Either test memory word and set value Or swap contents of two memory words 6.24 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

25 Synchronization Hardware General s/w solution to Critical-section Problem Using Locks do { acquire lock critical section release lock remainder section while (TRUE); 6.25 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

26 Mutual Exclusion solution using TestAndSet Mutual Exclusion using TestAndSet (hardware) instruction Shared boolean variable lock., initialized to false. Process Pi for mutual exclusion using TestAndSet atomic instruction initially lock =false; // global variable do { while ( TestAndSet (&lock )) ; // critical section lock = FALSE; // remainder section while (TRUE); //hardware, Atomic instruction boolean TestAndSet (boolean *target { boolean rv = *target; *target = TRUE; return rv: do { while ( TestAndSet (&lock )) ; // critical section lock = FALSE; // remainder section while (TRUE); 6.26 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

27 Mutual Exclusion Solution using Swap Instruction Mutual Exclusion Solution using Swap Shared Boolean variable lock initialized to FALSE; Each process has a local Boolean variable key Process Pi for mutual exclusion using Swap atomic instruction: initially lock=false //shared do { key = TRUE; //local variable while ( key == TRUE) Swap (&lock, &key ); // critical section lock = FALSE; // remainder section while (TRUE); void Swap (boolean *a, boolean *b) //hardware { boolean temp = *a; *a = *b; *b = temp: do { key = TRUE; //local variable while ( key == TRUE) Swap (&lock, &key ); // critical section lock = FALSE; // remainder section while (TRUE); 6.27 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

28 Bounded-waiting Mutual Exclusion with TestandSet() ( 유한대기상호배제소루션 ) do { waiting[i] = TRUE; // key = TRUE; while (waiting[i] && key) //proceed when waiting[i]==false or key(lock)=false key = TestAndSet(&lock); waiting[i] = FALSE; // critical section j = (i + 1) % n; while ((j!= i) &&!waiting[j]) // i다음의대기중인프로세스를활성화한다. Bounded waiting 보장 j = (j + 1) % n; if (j == i) lock = FALSE; // lock= false로하여다른프로세스에게허용 else waiting[j] = FALSE; // lock==true 인상태에서 Pj에서 wile문장을지나 critical section 진입하게한다. // remainder section while (TRUE); 6.28 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

29 세마포어 (Semaphore concept) Semaphore is A kind of general synchronization tool Aslo is able to be sued as a synchronization tool that does not require busy waiting Semaphore( 신호기 ) S : 원자적함수 wait() 과 signal() 로접근되는정수변수 S originally called P() and V(), (P from Duch proberen, to test. V from verhogen, to increment ) wait (S) { //atomic operation S:semaphor variable while (S <= 0) ; // S>0 때까지대기 S--; signal (S) { //atomic operation S++; 6.29 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

30 Usage of Semaphor Two types of semaphore Counting semaphore 무제한정수처리, N 개의자원관리공유시 Binary semaphore 정수 0,1,mutex locks An example of Binary semaphore Process p with mutual exclusion using semaphore mutex. Semaphore mutex=1; // initialized to 1 Shared data do { wait (mutex); // 1->0 or 다른프로세스가 1 로설정할때까지 busy waiting // Critical Section signal (mutex); // 0->1 // remainder section while (TRUE); An example of Counting semaphore N 개의공유자원을이용하기위한상호배제 Semaphore res=n ; // 공유자원수 : N do { Wait(res) //res 자원이용하기전 N==0이면모든자원이사용중 // Critical Section Signal(res) //res++ 자원이용후 // remainder section while(true); 6.30 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

31 Semaphore Implementation with no Busy waiting 기본개념 Wait 연산의대기를무한반복대신에대기큐에서수행되도록하여시스템의효율을증가시킨다. Semaphore 구조 typedef struct { int value; // struct process *L; //pointer to next record in the list semaphore; Two operations: block 프로세스를대기큐에추가하고일시중지 suspends the process, place the process invoking the operation on the appropriate waiting queue. wakeup 대기중인큐의포세스한개를분리하여 ready 큐에삽입하여실행을재개한다. resumes the execution of a blocked process, remove one of processes in the waiting queue and place it in the ready queue / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

32 Semaphore Implementation with no Busy waiting (Cont.) Implementation of wait: wait(semaphore *S) { S->value--; //-value 의 value 는대기중인 process 의수이다. if (S->value < 0) { add this process to S->list; //add itself onto waiting list block(); // 자신의프로세스는대기큐로이동 / 실행중지 // 0 : 다른프로세스실행방지시키고자신은계속실행 Implementation of signal: signal(semaphore *S) { S->value++; if (S->value <= 0) { remove a process P from S->list; wakeup(p); // OS scheduler 의 ready queue 로이동시킨다. // >=1 : 다른프로세스실행을허용 6.32 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

33 Deadlock and Starvation Deadlock 예 two or more processes are waiting indefinitely for an event(signal()) that can be caused by only one of the waiting processes ( 둘또는그이상의프로세스들이대기중인프로세스중하나가발생시킬이벤트를무한정기다리고있는상태 ) Let S and Q be two semaphores initialized to 1 where two processes P1,P2 ( 프로세스 P1,P2 가 3 개의세마포 S,M 를다음과같이사용하면발생가능 ) P 0 P 1 wait (S); wait (Q); wait (Q); wait (S);.... signal (S); signal (S); signal (Q); Starvation signal (Q); indefinite blocking. A process may never be removed from the semaphore queue in which it is suspended. (P0,P1 모두세마포대기큐에추가된상태면영원히재실행이불가하다.) 6.33 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

34 6.6 Classical Problems of Synchronization Bounded-Buffer Problem Readers and Writers Problem Dining-Philosophers Problem Semaphore 변수사용 6.34 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

35 Bounded Buffer Problem Synchronization with critical problem initially in=out=counter= / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

36 Bounded Buffer Problem (Cont d) Implementation with semaphores / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

37 C# Implementation with semaphores using C# language Mutex mutex = new Mutex() Semaphore empty = new Semaphore(N,N): Semaphore full =new Semaphore(0,N): void Produceer { while (true) { T t = Produce(); empty.waitone(); //empty mutex.waitone(); //mutex Append(t); mutex.releasemutex(); //mutex++ full.release(); //full++ void Consume er { while (true) { full.waitone(); //full mutex.waitone(); //mutex T t = Take(); mutex.releasemutex(); //mutex++ empty.release(); //empty-- Consume(t); / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

38 Semaphore 와 mutex 를이용한생산자 - 소비자문제 (C#) using System.Text; using System.Threading; abstract class ProCon<T> { public ProCon(int maxbuffersize) { this.maxbuffersize = maxbuffersize; mutex = new Mutex(); full = new Semaphore(0, maxbuffersize); empty = new Semaphore(maxBufferSize, maxbuffersize); public void Producer(){ public void Consumer(){ abstract public T Take(); abstract public void Append(T t); abstract public T Produce(); abstract public void Consume(T t); class MyProCon : ProCon<string> { protected List<string> list; public MyProCon(int maxsize) : base(maxsize) { list = new List<string>(maxSize); override public T Take() { override public void Append(T t) { override public T Produce() { override public void Consume(T t) { class Program { public static void Main(string[] args) { MyProCon m = new MyProCon(4); Thread pro = new Thread(m.Producer); pro.start(); // Thread pro2 = new Thread(m.Producer); //pro2.start(); Thread con = new Thread(m.Consumer); con.start(); Thread.Sleep(10000); //10 초정지 pro.suspend(); con.suspend(); //pro.join(); //con.join(); 6.38 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

39 abstract class ProCon<T> { protected readonly int maxbuffersize; protected Mutex mutex; protected Semaphore full; protected Semaphore empty; public ProCon(int maxbuffersize) { this.maxbuffersize = maxbuffersize; mutex = new Mutex(); full = new Semaphore(0, maxbuffersize); empty = new Semaphore(maxBufferSize, maxbuffersize); public void Producer() { while (true) { T t = Produce(); empty.waitone(); //empty-- mutex.waitone(); //mutex-- Append(t); mutex.releasemutex(); //mutex++ full.release(); //full++ public void Consumer() { while (true) { full.waitone(); //full-- mutex.waitone(); //mutex-- T t = Take(); mutex.releasemutex(); //mutex++ empty.release(); //empty++ Consume(t); //codes of critical section abstract public T Take(); abstract public void Append(T t); //non critical section abstract public T Produce(); abstract public void Consume(T t); class MyProCon : ProCon<string> { protected List<string> list; public MyProCon(int maxsize) : base(maxsize) { list = new List<string>(maxSize); // 데이터추가 ( 저장 ) //critical codes override public void Append(string t) { list.add(t); string s = ""; foreach (string a in list) s += a + " "; Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "\tadd : " + list.count + "\t:" + s); //Thread.Sleep(1000); // 데이터소비 //critical codes : override public string Take() { string t = list[0]; list.removeat(0); string s=""; foreach (string a in list) s += a + " "; Console.WriteLine(Thread.CurrentThread.ManagedThreadId+"\tTake: " + list.count + "\t:" +s); Thread.Sleep(2000); return t; // 데이터생성 override public string Produce() { Random r = new Random(); int i = r.next(10); Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "\tpro: " +i); return i.tostring(); // 데이터처리 override public void Consume(string t) { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "\tcon: " + t); 6.39 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

40 실행결과분석 void Main() { MyProCon m = new MyProCon(4); Thread pro = new Thread(m.Producer); Thread con = new Thread(m.Consumer); pro.start(); con.start(); Thread.Sleep(10000); //10 초정지 pro.suspend(); con.suspend(); Producer while (true) { 1 T t = Produce(); 2 empty.waitone(); //empty-- 3 mutex.waitone(); //mutex-- 4 Append(t); 5 mutex.releasemutex(); //mutex++ 6 full.release(); //full++ Consumer while (true) { 1 full.waitone(); //full 2 mutex.waitone(); //mutex 3 T t = Take(); 4 mutex.releasemutex(); //mutex++ 5 empty.release(); //empty++ 6 Consume(t); 3 1 Pro: add : 1 :4 3 1 Pro: Take: 0 : 3 4 add : 1 :4 3 1 Pro: add : 2 : Pro: add : 3 : Pro: 2 3 add : 4 : Pro: 2 4 Con: 4 4 Take: 3 : Con: 4 3 add : 4 : Take: 3 : Pro: 1 4 Con: 2 3 add : 4 : Take: 3 : Pro: 9 4 Con: 2 3 add : 4 : Pro: 8 4 Take: 3 : Con: / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

41 Readers-Writers Problem 복수의 reader 및 writer 프로세스들이데이터집합을공유하는문제 Readers 읽기전용, 복수의프로세스읽기가능, 수정불가능 Writers 읽고쓰기가능, writer 프로세스들끼리배타적공유 6.41 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

42 Shared Data, initially Readers-Writers Problem (Cont.) Semaphore mutex =1 //readcount 갱신시상호배제용 Semaphore wrt = 1 //writer 상호배제 Integer readcount =0 // reading process The structure of a writer process do { wait (wrt) ; //writing is performed //wrt=0 signal (wrt) ; //wrt=1 while (TRUE); The structure of a reader process do { wait (mutex) ; //mutex=0 readcount ++ ; if (readcount == 1) wait (wrt); // 첫번째 reading 시부터읽는동안 write 금지 signal (mutex) // reading is performed, // 복수프로세스가동시읽기가능 wait (mutex) ; readcount - - ; if (readcount == 0) signal (wrt) ; // 모두 (process) 읽으면쓰기허용 signal (mutex) ; //mutex=1 while (TRUE); 6.42 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

43 Dining-Philosophers Problem Dining philosopher problem Dijkstra, 1965 Life of a philosopher: Repeat forever Thinking Getting hungry Getting two chopsticks Eating The structure of Philosopher i: Shared Data Semaphor chopstick [5] initialized to 1 philosohphor pi do { wait ( chopstick[i] ); wait ( chopstick[ (i + 1) % 5] ); // eat signal ( chopstick[i] ); signal (chopstick[ (i + 1) % 5] ); // think while (TRUE); 6.43 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

44 Problems with Semaphores Correct use of semaphore operations: signal (mutex). wait (mutex) wait (mutex) wait (mutex) Omitting of wait (mutex) or signal (mutex) (or both) 6.44 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

45 Monitors concept 프로세스에서세마포변수를잘못사용하면다양한문제가발생된다. 이런문제를해결하기위하여세마포변수및프로시듀어를구조체 (struct) 안에정의하고추상화하고프로그래머는이프로시듀어를사용하여세마포변수를제어하므로서프로그램머의오류를줄일수있다. Signal(mutex) //critical section wait(mutex) 상호배제위반, 여러프로세스가동시실행,.. Wait(mutex) //critical section wait(mutex) 교착상태 6.45 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

46 Monitors Monitor 는멤버를을캡슐화는 software module 이다. 소프트웨어모듈 ( 구조체, 클래스 ) 이다. 공유데이터구조들과공유데이터구조에서실행되는프로시주어들을캡슐화한다. 이들프로시쥬어를호출하는동시실행주인프로세스간의동기화 한번에하나의프로세스만인활성화된다. 추상화된데이터타입의안전한공유 Monitor syntax(struct) monitor monitor-name { shared variable declarations procedure P1 ( ) {. procedure Pn ( ) { Initialization code (.) { 6.46 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

47 Monitors Condition variable( 개체 ) 모니터의멤버개체 ( 일종의 struct) condition x, y; 프로세스들이모니터내에서대기할수있는수단 condition 개체의멤버 operations wait and signal x.wait(); 프로세스가호출, suspended 상태진입 x.signal(); one suspended process 를재개시킨다. 만일 suspended 프로세스가없으로무시된다 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

48 Schematic view of a Monitor waiting queue of processes trying to enter the monitor at most one process in monitor at a time 6.48 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

49 Monitor with Condition Variables 6.49 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

50 Solution to Dining Philosophers 좌우의이웃철학자가젓가락을얻을수있을때만잡도록강제한다. 양쪽의철학자가식사를하지않을때만식사한다. 전체구조 monitor DP { pick(); putdown();.. while(1) { for all i in process Pi { think(); DP.pickup (i); eat(); DP.putdown (i); 6.50 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

51 monitor DP { Monitor Solution to Dining Philosophers enum { THINKING; HUNGRY, EATING) state [5] ; condition self [5]; void pickup (int i) { // state[i] = HUNGRY; // 상태를 hungry 로 test(i); // 죄우상태점검에따라서식사모드설정 if (state[i]!= EATING) self [i].wait(); // 식사모드로못들어갔으면대기상태로 void putdown (int i) { state[i] = THINKING; // 사색모드로 // test left and right neighbors test((i + 4) % 5); test((i + 1) % 5); void test (int i) { if ( (state[(i + 4) % 5]!= EATING) && (state[i] == HUNGRY) && // 우를점검하여식사대기중이었으면활성화 // 좌를점검하여식사대기중이었으면활성화 (state[(i + 1) % 5]!= EATING) ) // 좌우철학자가식사중이아니고내가 { // 배고프면 state[i] = EATING ; self[i].signal () ; void initialization code() { for (int i = 0; i < 5; i++) state[i] = THINKING; // 내상태를식사모드로설정 // 대기중이었으면자신을활성화 // 모든프로세스의상태를생각모드로 6.51 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

52 An example of a Monitor to Allocate Single Resource 하나의자원을할당해주는모니터 monitor ResourceAllocator { boolean busy; condition x; void acquire(int time) { if (busy) x.wait(time); //time 과함께저장큐에 busy = TRUE; void release() { busy = FALSE; x.signal(); initialization code() { busy = FALSE; 프로세스에서자원접근하는방법 R.acquire(t) 자원접근 R.release() t: 자원접근요청시간 6.52 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

53 Synchronization Examples Solaris Windows XP Linux Pthreads 6.53 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

54 Solaris Synchronization Implements a variety of locks to support multitasking, multithreading (including real-time threads), and multiprocessing Uses adaptive mutexes for efficiency when protecting data from short code segments Uses condition variables and readers-writers locks when longer sections of code need access to data Uses turnstiles to order the list of threads waiting to acquire either an adaptive mutex or reader-writer lock 6.54 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

55 Windows XP Synchronization Uses interrupt masks to protect access to global resources on uniprocessor systems Uses spinlocks on multiprocessor systems Also provides dispatcher objects which may act as either mutexes and semaphores Dispatcher objects may also provide events An event acts much like a condition variable 6.55 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

56 Linux Synchronization Linux: Prior to kernel Version 2.6, disables interrupts to implement short critical sections Version 2.6 and later, fully preemptive Linux provides: semaphores spin locks 6.56 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

57 Pthreads Synchronization Pthreads API is OS-independent It provides: mutex locks condition variables Non-portable extensions include: read-write locks spin locks 6.57 / 57 Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

58 End of Chapter 6, Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010

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

Module 7: Process Synchronization

Module 7:  Process Synchronization Chapter 6: Process Synchronization ( 프로세스동기화 ), Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2010 Module 6: Synchronization( 동기화 ) Background( 배경 ) The Critical-Section Problem( 임계구역문제 ) Peterson

More information

Microsoft PowerPoint - o6.pptx

Microsoft PowerPoint - o6.pptx 목표 6 장. 프로세스동기화 임계구역 (Critical Region) 문제소개 이문제에대한해결책은공유데이터의일관성유지에사용가능 임계구역문제의하드웨어및소프트웨어해결책제시 전통적인프로세스동기화문제소개 프로세스동기화문제해결에사용되는도구조사 2 6.1 배경 생산자 - 소비자문제 공유데이터사용 협력프로세스 (Cooperating process) 다른프로세스의실행을영향을주거나받는프로세스

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

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

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

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 - StallingsOS6e-Chap05.pptx

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

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

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

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

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

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

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh Page 1 of 6 Learn Korean Ep. 13: Whether (or not) and If Let s go over how to say Whether and If. An example in English would be I don t know whether he ll be there, or I don t know if he ll be there.

More information

쓰레드 (Thread) 양희재교수 / 경성대학교컴퓨터공학과

쓰레드 (Thread) 양희재교수 / 경성대학교컴퓨터공학과 쓰레드 (Thread) 양희재교수 (hjyang@ks.ac.kr) / 경성대학교컴퓨터공학과 Thread? 쓰레드 (Thread) 프로그램내부의흐름, 맥 class Test { public static void main(string[] args) { int n = 0; int m = 6; System.out.println(n+m); while (n < m) n++;

More information

Page 2 of 5 아니다 means to not be, and is therefore the opposite of 이다. While English simply turns words like to be or to exist negative by adding not,

Page 2 of 5 아니다 means to not be, and is therefore the opposite of 이다. While English simply turns words like to be or to exist negative by adding not, Page 1 of 5 Learn Korean Ep. 4: To be and To exist Of course to be and to exist are different verbs, but they re often confused by beginning students when learning Korean. In English we sometimes use the

More information

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

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

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

제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

입학사정관제도

입학사정관제도 운영체제 강의노트 교재 : 운영체제 ( 개정판 ) 출판사 : 한빛미디어 (2010 년 11 월발행 ) 저자 : 구현회 소프트웨어학과원성현교수 1 4 장 병행프로세스와 상호배제 소프트웨어학과원성현교수 2 1. 병행프로세스 병행프로세스의과제 병행성 동시에 2 개이상의프로세스가실행되는성질 다중프로세싱시스템, 분산처리시스템에서주로발생 다중프로세싱시스템은프로세서의효율성을증대시킴

More information

- 2 -

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

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

<32382DC3BBB0A2C0E5BED6C0DA2E687770>

<32382DC3BBB0A2C0E5BED6C0DA2E687770> 논문접수일 : 2014.12.20 심사일 : 2015.01.06 게재확정일 : 2015.01.27 청각 장애자들을 위한 보급형 휴대폰 액세서리 디자인 프로토타입 개발 Development Prototype of Low-end Mobile Phone Accessory Design for Hearing-impaired Person 주저자 : 윤수인 서경대학교 예술대학

More information

본문01

본문01 Ⅱ 논술 지도의 방법과 실제 2. 읽기에서 논술까지 의 개발 배경 읽기에서 논술까지 자료집 개발의 본래 목적은 초 중 고교 학교 평가에서 서술형 평가 비중이 2005 학년도 30%, 2006학년도 40%, 2007학년도 50%로 확대 되고, 2008학년도부터 대학 입시에서 논술 비중이 커지면서 논술 교육은 학교가 책임진다. 는 풍토 조성으로 공교육의 신뢰성과

More information

지능정보연구제 16 권제 1 호 2010 년 3 월 (pp.71~92),.,.,., Support Vector Machines,,., KOSPI200.,. * 지능정보연구제 16 권제 1 호 2010 년 3 월

지능정보연구제 16 권제 1 호 2010 년 3 월 (pp.71~92),.,.,., Support Vector Machines,,., KOSPI200.,. * 지능정보연구제 16 권제 1 호 2010 년 3 월 지능정보연구제 16 권제 1 호 2010 년 3 월 (pp.71~92),.,.,., Support Vector Machines,,., 2004 5 2009 12 KOSPI200.,. * 2009. 지능정보연구제 16 권제 1 호 2010 년 3 월 김선웅 안현철 社 1), 28 1, 2009, 4. 1. 지능정보연구제 16 권제 1 호 2010 년 3 월 Support

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

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

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

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

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V Mobile Service > IAP > Android SDK IAP SDK TOAST SDK. IAP SDK. Android Studio IDE 2.3.3 Android SDK Version 2.3.3 (API Level 10). Name Reference Version License okhttp http://square.github.io/okhttp/ 1.5.4

More information

<30322D28C6AF29C0CCB1E2B4EB35362D312E687770>

<30322D28C6AF29C0CCB1E2B4EB35362D312E687770> 한국학연구 56(2016.3.30), pp.33-63. 고려대학교 한국학연구소 세종시의 지역 정체성과 세종의 인문정신 * 1)이기대 ** 국문초록 세종시의 상황은 세종이 왕이 되면서 겪어야 했던 과정과 닮아 있다. 왕이 되리라 예상할 수 없었던 상황에서 세종은 왕이 되었고 어려움을 극복해 갔다. 세종시도 갑작스럽게 행정도시로 계획되었고 준비의 시간 또한 짧았지만,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Reasons for Poor Performance Programs 60% Design 20% System 2.5% Database 17.5% Source: ORACLE Performance Tuning 1 SMS TOOL DBA Monitoring TOOL Administration TOOL Performance Insight Backup SQL TUNING

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

Interstage5 SOAP서비스 설정 가이드

Interstage5 SOAP서비스 설정 가이드 Interstage 5 Application Server ( Solaris ) SOAP Service Internet Sample Test SOAP Server Application SOAP Client Application CORBA/SOAP Server Gateway CORBA/SOAP Gateway Client INTERSTAGE SOAP Service

More information

ESP1ºÎ-04

ESP1ºÎ-04 Chapter 04 4.1..,..,.,.,.,. RTOS(Real-Time Operating System)., RTOS.. VxWorks(www.windriver.com), psos(www.windriver.com), VRTX(www.mento. com), QNX(www.qnx.com), OSE(www.ose.com), Nucleus(www.atinudclus.

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

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

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

11¹Ú´ö±Ô

11¹Ú´ö±Ô A Review on Promotion of Storytelling Local Cultures - 265 - 2-266 - 3-267 - 4-268 - 5-269 - 6 7-270 - 7-271 - 8-272 - 9-273 - 10-274 - 11-275 - 12-276 - 13-277 - 14-278 - 15-279 - 16 7-280 - 17-281 -

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

step 1-1

step 1-1 Written by Dr. In Ku Kim-Marshall STEP BY STEP Korean 1 through 15 Action Verbs Table of Contents Unit 1 The Korean Alphabet, hangeul Unit 2 Korean Sentences with 15 Action Verbs Introduction Review Exercises

More information

K7VT2_QIG_v3

K7VT2_QIG_v3 1......... 2 3..\ 4 5 [R] : Enter Raid setup utility 6 Press[A]keytocreateRAID RAID Type: JBOD RAID 0 RAID 1: 2 7 " RAID 0 Auto Create Manual Create: 2 RAID 0 Block Size: 16K 32K

More information

APOGEE Insight_KR_Base_3P11

APOGEE Insight_KR_Base_3P11 Technical Specification Sheet Document No. 149-332P25 September, 2010 Insight 3.11 Base Workstation 그림 1. Insight Base 메인메뉴 Insight Base Insight Insight Base, Insight Base Insight Base Insight Windows

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

Microsoft Word - ExecutionStack

Microsoft Word - ExecutionStack Lecture 15: LM code from high level language /* Simple Program */ external int get_int(); external void put_int(); int sum; clear_sum() { sum=0; int step=2; main() { register int i; static int count; clear_sum();

More information

<31325FB1E8B0E6BCBA2E687770>

<31325FB1E8B0E6BCBA2E687770> 88 / 한국전산유체공학회지 제15권, 제1호, pp.88-94, 2010. 3 관내 유동 해석을 위한 웹기반 자바 프로그램 개발 김 경 성, 1 박 종 천 *2 DEVELOPMENT OF WEB-BASED JAVA PROGRAM FOR NUMERICAL ANALYSIS OF PIPE FLOW K.S. Kim 1 and J.C. Park *2 In general,

More information

#중등독해1-1단원(8~35)학

#중등독해1-1단원(8~35)학 Life Unit 1 Unit 2 Unit 3 Unit 4 Food Pets Camping Travel Unit 1 Food Before You Read Pre-reading Questions 1. Do you know what you should or shouldn t do at a traditional Chinese dinner? 2. Do you think

More information

<32B1B3BDC32E687770>

<32B1B3BDC32E687770> 008년도 상반기 제회 한 국 어 능 력 시 험 The th Test of Proficiency in Korean 일반 한국어(S-TOPIK 중급(Intermediate A 교시 이해 ( 듣기, 읽기 수험번호(Registration No. 이 름 (Name 한국어(Korean 영 어(English 유 의 사 항 Information. 시험 시작 지시가 있을

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

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

204 205

204 205 -Road Traffic Crime and Emergency Evacuation - 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 Abstract Road Traffic Crime

More information

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf(hihi\n); } warning: conflicting types for functiona 이름 : 학번 : A. True or False: 각각항목마다 True 인지 False 인지적으세요. 1. (Python:) randint 함수를사용하려면, random 모듈을 import 해야한다. 2. (Python:) '' (single quote) 는한글자를표현할때, (double quote) 는문자열을표현할때사용한다. B. 다음에러를수정하는방법을적으세요.

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

4번.hwp

4번.hwp Journal of International Culture, Vol.9-1 International Cultural Institute, 2016, 55~63 浅 析 影 响 韩 中 翻 译 的 因 素 A Brief Analysis on Factors that Affects Korean-Chinese Translation 韩 菁 (Han, Jing) 1) < 目

More information

Figure 5.01

Figure 5.01 Chapter 4: Threads Yoon-Joong Kim Hanbat National University, Computer Engineering Department Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues Operating

More information

대한한의학원전학회지26권4호-교정본(1125).hwp

대한한의학원전학회지26권4호-교정본(1125).hwp http://www.wonjeon.org http://dx.doi.org/10.14369/skmc.2013.26.4.267 熱入血室證에 대한 小考 1 2 慶熙大學校大學校 韓醫學科大學 原典學敎室 韓醫學古典硏究所 白裕相1, 2 *117) A Study on the Pattern of 'Heat Entering The Blood Chamber' 1, Baik 1

More information

김기남_ATDC2016_160620_[키노트].key

김기남_ATDC2016_160620_[키노트].key metatron Enterprise Big Data SKT Metatron/Big Data Big Data Big Data... metatron Ready to Enterprise Big Data Big Data Big Data Big Data?? Data Raw. CRM SCM MES TCO Data & Store & Processing Computational

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

슬라이드 1

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

More information

DE1-SoC Board

DE1-SoC Board 실습 1 개발환경 DE1-SoC Board Design Tools - Installation Download & Install Quartus Prime Lite Edition http://www.altera.com/ Quartus Prime (includes Nios II EDS) Nios II Embedded Design Suite (EDS) is automatically

More information

¹Ìµå¹Ì3Â÷Àμâ

¹Ìµå¹Ì3Â÷Àμâ MIDME LOGISTICS Trusted Solutions for 02 CEO MESSAGE MIDME LOGISTICS CO., LTD. 01 Ceo Message We, MIDME LOGISTICS CO., LTD. has established to create aduance logistics service. Try to give confidence to

More information

#Ȳ¿ë¼®

#Ȳ¿ë¼® http://www.kbc.go.kr/ A B yk u δ = 2u k 1 = yk u = 0. 659 2nu k = 1 k k 1 n yk k Abstract Web Repertoire and Concentration Rate : Analysing Web Traffic Data Yong - Suk Hwang (Research

More information

2002년 2학기 자료구조

2002년 2학기 자료구조 자료구조 (Data Structures) Chapter 1 Basic Concepts Overview : Data (1) Data vs Information (2) Data Linear list( 선형리스트 ) - Sequential list : - Linked list : Nonlinear list( 비선형리스트 ) - Tree : - Graph : (3)

More information

λx.x (λz.λx.x z) (λx.x)(λz.(λx.x)z) (λz.(λx.x) z) Call-by Name. Normal Order. (λz.z)

λx.x (λz.λx.x z) (λx.x)(λz.(λx.x)z) (λz.(λx.x) z) Call-by Name. Normal Order. (λz.z) λx.x (λz.λx.x z) (λx.x)(λz.(λx.x)z) (λz.(λx.x) z) Call-by Name. Normal Order. (λz.z) Simple Type System - - 1+malloc(), {x:=1,y:=2}+2,... (stuck) { } { } ADD σ,m e 1 n 1,M σ,m e 1 σ,m e 2 n 2,M + e 2 n

More information

thesis

thesis ( Design and Implementation of a Generalized Management Information Repository Service for Network and System Management ) ssp@nile nile.postech.ac..ac.kr DPE Lab. 1997 12 16 GMIRS GMIRS GMIRS prototype

More information

歯3이화진

歯3이화진 http://www.kbc.go.kr/ Abstract Terrestrial Broadcasters Strategies in the Age of Digital Broadcasting Wha-Jin Lee The purpose of this research is firstly to investigate the

More information

비긴쿡-자바 00앞부속

비긴쿡-자바 00앞부속 IT COOKBOOK 14 Java P r e f a c e Stay HungryStay Foolish 3D 15 C 3 16 Stay HungryStay Foolish CEO 2005 L e c t u r e S c h e d u l e 1 14 PPT API C A b o u t T h i s B o o k IT CookBook for Beginner Chapter

More information

歯1.PDF

歯1.PDF 200176 .,.,.,. 5... 1/2. /. / 2. . 293.33 (54.32%), 65.54(12.13%), / 53.80(9.96%), 25.60(4.74%), 5.22(0.97%). / 3 S (1997)14.59% (1971) 10%, (1977).5%~11.5%, (1986)

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

I&IRC5 TG_08권

I&IRC5 TG_08권 I N T E R E S T I N G A N D I N F O R M A T I V E R E A D I N G C L U B The Greatest Physicist of Our Time Written by Denny Sargent Michael Wyatt I&I Reading Club 103 본문 해석 설명하기 위해 근래의 어떤 과학자보다도 더 많은 노력을

More information

DIY 챗봇 - LangCon

DIY 챗봇 - LangCon without Chatbot Builder & Deep Learning bage79@gmail.com Chatbot Builder (=Dialogue Manager),. We need different chatbot builders for various chatbot services. Chatbot builders can t call some external

More information

UI TASK & KEY EVENT

UI TASK & KEY EVENT KEY EVENT & STATE 구현 2007. 1. 25 PLATFORM TEAM 정용학 차례 Key Event HS TASK UI TASK LONG KEY STATE 구현 소스코드및실행화면 질의응답및토의 2 KEY EVENT - HS TASK hs_task keypad_scan_keypad hs_init keypad_pass_key_code keypad_init

More information

thesis

thesis CORBA TMN Surveillance System DPNM Lab, GSIT, POSTECH Email: mnd@postech.ac.kr Contents Motivation & Goal Related Work CORBA TMN Surveillance System Implementation Conclusion & Future Work 2 Motivation

More information

Chapter 4. LISTS

Chapter 4. LISTS 연결리스트의응용 류관희 충북대학교 1 체인연산 체인을역순으로만드는 (inverting) 연산 3 개의포인터를적절히이용하여제자리 (in place) 에서문제를해결 typedef struct listnode *listpointer; typedef struct listnode { char data; listpointer link; ; 2 체인연산 체인을역순으로만드는

More information

The Self-Managing Database : Automatic Health Monitoring and Alerting

The Self-Managing Database : Automatic Health Monitoring and Alerting The Self-Managing Database : Automatic Health Monitoring and Alerting Agenda Oracle 10g Enterpirse Manager Oracle 10g 3 rd Party PL/SQL API Summary (Self-Managing Database) ? 6% 6% 12% 55% 6% Source: IOUG

More information

±èÇö¿í Ãâ·Â

±èÇö¿í Ãâ·Â Smartphone Technical Trends and Security Technologies The smartphone market is increasing very rapidly due to the customer needs and industry trends with wireless carriers, device manufacturers, OS venders,

More information

03.Agile.key

03.Agile.key CSE4006 Software Engineering Agile Development Scott Uk-Jin Lee Division of Computer Science, College of Computing Hanyang University ERICA Campus 1 st Semester 2018 Background of Agile SW Development

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

untitled

untitled SAS Korea / Professional Service Division 2 3 Corporate Performance Management Definition ý... is a system that provides organizations with a method of measuring and aligning the organization strategy

More information

하나님의 선한 손의 도우심 이세상에서 가장 큰 축복은 하나님이 나와 함께 하시는 것입니다. 그 이 유는 하나님이 모든 축복의 근원이시기 때문입니다. 에스라서에 보면 하나님의 선한 손의 도우심이 함께 했던 사람의 이야기 가 나와 있는데 에스라 7장은 거듭해서 그 비결을

하나님의 선한 손의 도우심 이세상에서 가장 큰 축복은 하나님이 나와 함께 하시는 것입니다. 그 이 유는 하나님이 모든 축복의 근원이시기 때문입니다. 에스라서에 보면 하나님의 선한 손의 도우심이 함께 했던 사람의 이야기 가 나와 있는데 에스라 7장은 거듭해서 그 비결을 새벽이슬 2 0 1 3 a u g u s t 내가 이스라엘에게 이슬과 같으리니 그가 백합화같이 피 겠고 레바논 백향목같이 뿌리가 박힐것이라. Vol 5 Number 3 호세아 14:5 하나님의 선한 손의 도우심 이세상에서 가장 큰 축복은 하나님이 나와 함께 하시는 것입니다. 그 이 유는 하나님이 모든 축복의 근원이시기 때문입니다. 에스라서에 보면 하나님의 선한

More information

0125_ 워크샵 발표자료_완성.key

0125_ 워크샵 발표자료_완성.key WordPress is a free and open-source content management system (CMS) based on PHP and MySQL. WordPress is installed on a web server, which either is part of an Internet hosting service or is a network host

More information

<C7D1B9CEC1B7BEEEB9AEC7D03631C1FD28C3D6C1BE292E687770>

<C7D1B9CEC1B7BEEEB9AEC7D03631C1FD28C3D6C1BE292E687770> 설화에 나타난 사회구조와 그 의미 23) 박유미 * 차례 Ⅰ. 문제제기 Ⅱ. 서사 내부의 사회구조 Ⅲ. 사회문제의 해결방식과 그 의미 Ⅳ. 설화와 후대전승과의 상관관계 Ⅴ. 결론 국문초록 삼국유사 의 조에는 왕거인 이야기와 거타지 이야기가 하나의 설화에 묶여 전하고 있는데, 두 이야기는 해결구조에서 차이를

More information

Oracle9i Real Application Clusters

Oracle9i Real Application Clusters Senior Sales Consultant Oracle Corporation Oracle9i Real Application Clusters Agenda? ? (interconnect) (clusterware) Oracle9i Real Application Clusters computing is a breakthrough technology. The ability

More information

휠세미나3 ver0.4

휠세미나3 ver0.4 andromeda@sparcs:/$ ls -al dev/sda* brw-rw---- 1 root disk 8, 0 2014-06-09 18:43 dev/sda brw-rw---- 1 root disk 8, 1 2014-06-09 18:43 dev/sda1 brw-rw---- 1 root disk 8, 2 2014-06-09 18:43 dev/sda2 andromeda@sparcs:/$

More information

2 min 응용 말하기 01 I set my alarm for 7. 02 It goes off. 03 It doesn t go off. 04 I sleep in. 05 I make my bed. 06 I brush my teeth. 07 I take a shower.

2 min 응용 말하기 01 I set my alarm for 7. 02 It goes off. 03 It doesn t go off. 04 I sleep in. 05 I make my bed. 06 I brush my teeth. 07 I take a shower. 스피킹 매트릭스 특별 체험판 정답 및 스크립트 30초 영어 말하기 INPUT DAY 01 p.10~12 3 min 집중 훈련 01 I * wake up * at 7. 02 I * eat * an apple. 03 I * go * to school. 04 I * put on * my shoes. 05 I * wash * my hands. 06 I * leave

More information

Chapter 4. LISTS

Chapter 4. LISTS 6. 동치관계 (Equivalence Relations) 동치관계 reflexive, symmetric, transitive 성질을만족 "equal to"(=) 관계는동치관계임. x = x x = y 이면 y = x x = y 이고 y = z 이면 x = z 동치관계를이용하여집합 S 를 동치클래스 로분할 동일한클래스내의원소 x, y 에대해서는 x y 관계성립

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

Microsoft PowerPoint - 27.pptx

Microsoft PowerPoint - 27.pptx 이산수학 () n-항관계 (n-ary Relations) 2011년봄학기 강원대학교컴퓨터과학전공문양세 n-ary Relations (n-항관계 ) An n-ary relation R on sets A 1,,A n, written R:A 1,,A n, is a subset R A 1 A n. (A 1,,A n 에대한 n- 항관계 R 은 A 1 A n 의부분집합이다.)

More information

` Companies need to play various roles as the network of supply chain gradually expands. Companies are required to form a supply chain with outsourcing or partnerships since a company can not

More information

Let G = (V, E) be a connected, undirected graph with a real-valued weight function w defined on E. Let A be a set of E, possibly empty, that is includ

Let G = (V, E) be a connected, undirected graph with a real-valued weight function w defined on E. Let A be a set of E, possibly empty, that is includ 알고리즘설계와분석 (CSE3081(2 반 )) 기말고사 (2016년 12월15일 ( 목 ) 오전 9시40분 ~) 담당교수 : 서강대학교컴퓨터공학과임인성 < 주의 > 답안지에답을쓴후제출할것. 만약공간이부족하면답안지의뒷면을이용하고, 반드시답을쓰는칸에어느쪽의뒷면에답을기술하였는지명시할것. 연습지는수거하지않음. function MakeSet(x) { x.parent

More information

CompareAndSet(CAS) 함수는 address 주소의값이 oldvalue 인지비교해서같으면 newvalue 로 바꾼다. 소프트웨어 lock 을사용하는것이아니고, 하드웨어에서제공하는기능이므로더빠르고 간편하다. X86 에서는 _InterlockedCompareEx

CompareAndSet(CAS) 함수는 address 주소의값이 oldvalue 인지비교해서같으면 newvalue 로 바꾼다. 소프트웨어 lock 을사용하는것이아니고, 하드웨어에서제공하는기능이므로더빠르고 간편하다. X86 에서는 _InterlockedCompareEx NON-BLOCKING ALGORITHM Homepage: https://sites.google.com/site/doc4code/ Email: goldpotion@outlook.com 2011/10/23 멀티쓰레드환경에서알아두면유용한자료구조에대해소개해본다. HARDWARE PRIMITIVE 효율적인구현을위해, Hardware 에서제공하는기능을이용해야한다. 자주쓰는기능에대해

More information

PRO1_04E [읽기 전용]

PRO1_04E [읽기 전용] Siemens AG 1999 All rights reserved File: PRO1_04E1 Information and S7-300 2 S7-400 3 EPROM / 4 5 6 HW Config 7 8 9 CPU 10 CPU : 11 CPU : 12 CPU : 13 CPU : / 14 CPU : 15 CPU : / 16 HW 17 HW PG 18 SIMATIC

More information

<B3EDB9AEC1FD5F3235C1FD2E687770>

<B3EDB9AEC1FD5F3235C1FD2E687770> 경상북도 자연태음악의 소박집합, 장단유형, 전단후장 경상북도 자연태음악의 소박집합, 장단유형, 전단후장 - 전통 동요 및 부녀요를 중심으로 - 이 보 형 1) * 한국의 자연태 음악 특성 가운데 보편적인 특성은 대충 밝혀졌지만 소박집합에 의한 장단주기 박자유형, 장단유형, 같은 층위 전후 구성성분의 시가( 時 價 )형태 등 은 밝혀지지 않았으므로

More information

(2005) ,,.,..,,..,.,,,,,

(2005) ,,.,..,,..,.,,,,, (2005)... 20...,,.,..,,..,.,,,,, 24. 24. 1). 24. 24. 24. 24. PC,,, 24..,. (Paul Virilio).... (George Ritzer),.,,,. 2). 1), 24,,, 2001. 17. 2),,,, 2001, 22. . 3)... 4) 1. 20 1989.. 24.. 5),.,,,,,. 6).,,

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M.

HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M. 오늘할것 5 6 HW5 Exercise 1 (60pts) M interpreter with a simple type system M. M. M.., M (simple type system). M, M. M., M. Review: 5-2 7 7 17 5 4 3 4 OR 0 2 1 2 ~20 ~40 ~60 ~80 ~100 M 언어 e ::= const constant

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

04-다시_고속철도61~80p

04-다시_고속철도61~80p Approach for Value Improvement to Increase High-speed Railway Speed An effective way to develop a highly competitive system is to create a new market place that can create new values. Creating tools and

More information

DBPIA-NURIMEDIA

DBPIA-NURIMEDIA The e-business Studies Volume 17, Number 4, August, 30, 2016:319~332 Received: 2016/07/28, Accepted: 2016/08/28 Revised: 2016/08/27, Published: 2016/08/30 [ABSTRACT] This paper examined what determina

More information