MoonNote

반응형

This VI has a race condition. Why?

1. The bottom While Loop could stop before the top loop stops.

2. Numeric Control could be inserted into the array before being incremented.

3. Numeric Control is executed twice in the top While Loop.

4. LabVIEW always prioritizes execution of the top loop.


정답 보기는 아래 더보기 클릭

 

더보기

정답 : 2. Numeric Control could be inserted into the array before being incremented.

블록다이어그램 코드를 보고 경합 조건(Race condition)이 발생한 이유를 찾는 문제이다. 먼저 위쪽 루프를 1번, 아래쪽 루프를 2번이라고 하였을 때 루프 타임을 보면 1번 루프 타임(500ms)이, 2번 루프  타임(1ms)보다 느리게 실행된다. 두 루프 간 데이터를 공유하는 변수를 살펴보면 불리언 타입의 "Add Incremented Value to Array" 입력 버튼과 숫자형 타입의 "Numeric Control" 입력 컨트롤이 있다. 코드 실행은 Increment? 값이 눌러졌을 경우 500ms마다 Numeric Control 값이 증분(+1)하게 되고, 이 값을 2번 루프에서 배열에 삽입하는 구조로 코드가 작성되어있다. 다만, 두 루프 간 변수를 통해 데이터를 전달하기 때문에 따로 Sequencial하게 코드가 작성되어지는 것은 아니라는 점을 생각해보면 증분(+1)하기 전의 값을 2번 루프에서 읽을지 증분(+1)한 값을 읽어들이는지 해당 코드만 가지고는 알기 어렵다. 따라서, 정답은  2. Numeric Control could be inserted into the array before being incremented.이다.

 

 

 

 

 

 

 

 

 

 

※ 이 글이 도움이 되었다면 "👆🏻구독"과 "🤍공감" 버튼을 클릭해주세요. 클릭 한번이 글 쓰는데 큰 힘이 됩니다.

 

 

공유하기

facebook twitter kakaoTalk kakaostory naver band