for Robot Artificial Inteligence

CPU Ultilization

|

CPU Utilization https://peteris.rocks/blog/htop/

use htop

command : htop

it visualize cpu和内存占率多少

PID : Process ID(Every time a new process is started it is assigned an identification number (ID) which is called process ID or PID for short.)

PRI : Priority(The priority (PRI) is the kernel-space priority that the Linux kernel is using. Priorities range from 0 to 139 and the range from 0 to 99 is real time and 100 to 139 for users.)

When you have more tasks to run than the number of available CPU cores, you somehow have to decide which tasks to run next and which ones to keep waiting. This is what the task scheduler is responsible for.

The scheduler in the Linux kernel is responsible for choosing which process on a run queue to pick next and it depends on the scheduler algorithm used in the kernel.

NI : Niceness (NI) is user-space priority to processes, ranging from -20 which is the highest priority to 19 which is the lowest priority. It can be confusing but you can think that a nice process yields to a less nice process. So the nicer a process is, the more it yields.

From what I’ve pieced together by reading StackOverflow and other sites, a niceness level increase by 1 should yield a 10% more CPU time to the process.

Memory usage - VIRT/RES/SHR/MEM VIRT/VSZ - Virtual Image The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used. VIRT is virtual memory usage. It includes everything, including memory mapped files.

RES/RSS - Resident size RES is resident memory usage i.e. what’s currently in the physical memory.

While RES can be a better indicator of how much memory a process is using than VIRT, keep in mind that

this does not include the swapped out memory
some of the memory may be shared with other processes

If a process uses 1 GB of memory and it calls fork(), the result of forking will be two processes whose RES is both 1 GB but only 1 GB will actually be used since Linux uses copy-on-write.

SHR - Shared Mem size The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.

MEM% - Memory usage A task’s currently used share of available physical memory. This is RES divided by the total RAM you have. If RES is 400M and you have 8 gigabytes of RAM, MEM% will be 400/8192*100 = 4.88%.

TIME is the cumulative time the CPU (any CPU) spent running any thread in the process since it was started. So it can even go faster than real-time if you have several CPU cores and the process is multi-threaded. https://unix.stackexchange.com/questions/121549/what-does-it-mean-exactly-when-a-processes-time-has-stopped-in-top

Comment  Read more

CI and CD 목적이 뭘까

|

continuous integration / continuous deliver

궁극적으로 온라인 update을 하기 위해 사용한다(예를 들어 로봇이 있다고 하면, 온라인으로 소프트웨어를 업데이트를 해주는 것이다.

https://www.redhat.com/ko/topics/devops/what-is-ci-cd

Comment  Read more

C파일에 구현된 함수를 C++에 사용하는 방법

|

cpp파일에서 c파일에 구현 되어있는 함수를 call 하는 방법은 c파일에 구현되어 있는 함수의 정의가 적혀있는 header파일을

#ifndef _FILENAME_H_
#define _FILENAME_H_

#ifdef __cplusplus
extern "C"{
#endif
...
#ifdef __cplusplus

}
#endif
#endif /* _FILENAME_H_ */

위와 같이 extern “C{}”로 감싸면 해결된다.

Comment  Read more

c++에서 Atomic은 무엇인가

|

http://egloos.zum.com/sweeper/v/3059861

std::atomic 은 원자성을 보존해주기 위해서 사용된다. 다시 말하자면 mutex 없이도 두 개의 스레드가 동시에 접근해도 data race 문제가 발생하지 않는다. volatile 은 컴파일러가 최적화하며 특정 라인을 수행하지 않는 경우가 없도록 해준다

https://pppgod.tistory.com/61

https://jjeongil.tistory.com/155

즉, single variable이 한 쓰레드 할당이 되면서 background으로 계속 도는 것이다. 이는 보통 0,1 or true or false 같인 variable을 사용한다

예) main thread module은 계속 돌면서, shut_down 커멘트가 눌러졌지 따로 글로벌적으로 Thread가 돌고, shut_down이 눌러지면 멈추도록 trigger을 줄 수 있다.

Comment  Read more

3-D Reconstruction with Vision

|

https://towardsdatascience.com/3-d-reconstruction-with-vision-ef0f80cbb299

Homography is Note that the homography matrix is a mapping between two planes. We have considered it here as a mapping from the image plane to a physical plane, but it could map between two image planes. The inverse of a homography will also provide the reverse mapping between the two planes.

disparity in image processing The disparity image is one where the value of each pixel is inversely related to the distance between that point in the scene and the camera.

Comment  Read more